Draw minimap units in SDL_gpu builds.
This commit is contained in:
parent
e6a1b2f745
commit
ac0bfc77d2
3 changed files with 12 additions and 6 deletions
|
@ -2010,7 +2010,9 @@ void display::draw_minimap()
|
|||
}
|
||||
|
||||
#ifdef SDL_GPU
|
||||
image::draw_minimap(screen_, area, get_map(), &dc_->teams()[currentTeam_], NULL);
|
||||
minimap_location_ = image::draw_minimap(screen_, area, get_map(), &dc_->teams()[currentTeam_], NULL);
|
||||
|
||||
draw_minimap_units();
|
||||
#else
|
||||
if(minimap_ == NULL || minimap_->w > area.w || minimap_->h > area.h) {
|
||||
minimap_ = image::getMinimap(area.w, area.h, get_map(), &dc_->teams()[currentTeam_], (selectedHex_.valid() && !is_blindfolded()) ? &reach_map_ : NULL);
|
||||
|
@ -2098,8 +2100,6 @@ void display::draw_minimap_units()
|
|||
}
|
||||
}
|
||||
|
||||
const Uint32 mapped_col = SDL_MapRGB(video().getSurface()->format,col.r,col.g,col.b);
|
||||
|
||||
double u_x = u->get_location().x * xscaling;
|
||||
double u_y = (u->get_location().y + (is_odd(u->get_location().x) ? 1 : -1)/4.0) * yscaling;
|
||||
// use 4/3 to compensate the horizontal hexes imbrication
|
||||
|
@ -2110,8 +2110,12 @@ void display::draw_minimap_units()
|
|||
, minimap_location_.y + round_double(u_y)
|
||||
, round_double(u_w)
|
||||
, round_double(u_h));
|
||||
|
||||
#ifdef SDL_GPU
|
||||
sdl::fill_rect(*get_render_target(), r, col);
|
||||
#else
|
||||
const Uint32 mapped_col = SDL_MapRGB(video().getSurface()->format,col.r,col.g,col.b);
|
||||
sdl::fill_rect(video().getSurface(), &r, mapped_col);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ surface getMinimap(int w, int h, const gamemap &map, const team *vw, const std::
|
|||
}
|
||||
|
||||
#ifdef SDL_GPU
|
||||
void draw_minimap(CVideo &video, const SDL_Rect &area, const gamemap &map, const team *vw, const std::map<map_location, unsigned int> *reach_map)
|
||||
SDL_Rect draw_minimap(CVideo &video, const SDL_Rect &area, const gamemap &map, const team *vw, const std::map<map_location, unsigned int> *reach_map)
|
||||
{
|
||||
const float width = map.w() * 72 * 3/4;
|
||||
const float height = map.h() * 72 + 72 * 1/4;
|
||||
|
@ -415,6 +415,8 @@ void draw_minimap(CVideo &video, const SDL_Rect &area, const gamemap &map, const
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sdl::create_rect(xoff, yoff, width * scale_factor, height * scale_factor);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace image {
|
|||
///function to create the minimap for a given map
|
||||
///the surface returned must be freed by the user
|
||||
#ifdef SDL_GPU
|
||||
void draw_minimap(CVideo &video, const SDL_Rect &area, const gamemap &map, const team *vw = NULL, const std::map<map_location,unsigned int> *reach_map = NULL);
|
||||
SDL_Rect draw_minimap(CVideo &video, const SDL_Rect &area, const gamemap &map, const team *vw = NULL, const std::map<map_location,unsigned int> *reach_map = NULL);
|
||||
#endif
|
||||
surface getMinimap(int w, int h, const gamemap &map_, const team *vm = NULL, const std::map<map_location,unsigned int> *reach_map = NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue