mirror of
https://github.com/wesnoth/wesnoth
synced 2024-09-20 07:51:33 +00:00
Display: add get_location_rect
This commit is contained in:
parent
7bd657e2a5
commit
7380885226
|
@ -702,6 +702,12 @@ point display::get_location(const map_location& loc) const
|
|||
};
|
||||
}
|
||||
|
||||
rect display::get_location_rect(const map_location& loc) const
|
||||
{
|
||||
// TODO: evaluate how these functions should be defined in terms of each other
|
||||
return { get_location(loc), point{hex_size(), hex_size()} };
|
||||
}
|
||||
|
||||
map_location display::minimap_location_on(int x, int y)
|
||||
{
|
||||
// TODO: don't return location for this,
|
||||
|
@ -1266,14 +1272,7 @@ uint32_t generate_hex_key(const drawing_layer layer, const map_location& loc)
|
|||
|
||||
void display::drawing_buffer_add(const drawing_layer layer, const map_location& loc, decltype(draw_helper::do_draw) draw_func)
|
||||
{
|
||||
const rect dest {
|
||||
get_location_x(loc),
|
||||
get_location_y(loc),
|
||||
int(zoom_),
|
||||
int(zoom_)
|
||||
};
|
||||
|
||||
drawing_buffer_.AGGREGATE_EMPLACE(generate_hex_key(layer, loc), draw_func, dest);
|
||||
drawing_buffer_.AGGREGATE_EMPLACE(generate_hex_key(layer, loc), draw_func, get_location_rect(loc));
|
||||
}
|
||||
|
||||
void display::drawing_buffer_commit()
|
||||
|
|
|
@ -315,6 +315,9 @@ public:
|
|||
int get_location_y(const map_location& loc) const;
|
||||
point get_location(const map_location& loc) const;
|
||||
|
||||
/** Returns the on-screen rect corresponding to a @a loc */
|
||||
rect get_location_rect(const map_location& loc) const;
|
||||
|
||||
/**
|
||||
* Rectangular area of hexes, allowing to decide how the top and bottom
|
||||
* edges handles the vertical shift for each parity of the x coordinate
|
||||
|
|
Loading…
Reference in New Issue
Block a user