fixes a small offset problem.
It's not really noticable but will be once the new centering code will be committed.
This commit is contained in:
parent
755cd37630
commit
a3e0e197f1
1 changed files with 8 additions and 0 deletions
|
@ -369,6 +369,14 @@ gamemap::location display::pixel_position_to_hex(int x, int y, gamemap::location
|
|||
|
||||
void display::get_rect_hex_bounds(SDL_Rect rect, gamemap::location &topleft, gamemap::location &bottomright) const
|
||||
{
|
||||
// change the coordinates of the rect send to be relative
|
||||
// to the map area instead of the screen area
|
||||
const SDL_Rect& map_rect = map_area();
|
||||
rect.x -= map_rect.x;
|
||||
rect.y -= map_rect.y;
|
||||
rect.w += map_rect.x;
|
||||
rect.h += map_rect.y;
|
||||
|
||||
const int tile_width = hex_width();
|
||||
|
||||
topleft.x = (xpos_ + rect.x) / tile_width;
|
||||
|
|
Loading…
Add table
Reference in a new issue