Cleaned up some cases of unnecessary manual scaling

The passed react already compensates for zoom (its dimensions are the modified hex sizes).
We don't need to manually scale to zoom.
This commit is contained in:
Charles Dang 2023-05-25 00:24:55 -04:00
parent 8bbefdd6c5
commit 3526bd42e3
4 changed files with 13 additions and 19 deletions

View File

@ -140,9 +140,8 @@ bool arrow::path_contains(const map_location& hex) const
void arrow::draw_hex(const map_location& hex)
{
if(path_contains(hex)) {
display* disp = display::get_singleton();
disp->drawing_buffer_add(layer_, hex, [disp, tex = image::get_texture(symbols_map_[hex])](const rect& dest) {
draw::blit(tex, disp->scaled_to_zoom({dest.x, dest.y, tex.w(), tex.h()}));
display::get_singleton()->drawing_buffer_add(layer_, hex, [tex = image::get_texture(symbols_map_[hex])](const rect& dest) {
draw::blit(tex, dest);
});
}
}

View File

@ -82,14 +82,14 @@ void editor_display::draw_hex(const map_location& loc)
if(map().in_selection(loc)) {
drawing_buffer_add(LAYER_FOG_SHROUD, loc,
[tex = image::get_texture("editor/selection-overlay.png", image::TOD_COLORED)](const rect& d) {
draw::blit(tex, scaled_to_zoom({d.x, d.y, tex.w(), tex.h()}));
draw::blit(tex, d);
});
}
if(brush_locations_.find(loc) != brush_locations_.end()) {
static const image::locator brush(game_config::images::editor_brush);
drawing_buffer_add(LAYER_SELECTED_HEX, loc, [tex = image::get_texture(brush, image::HEXED)](const rect& d) {
draw::blit(tex, scaled_to_zoom({d.x, d.y, tex.w(), tex.h()}));
draw::blit(tex, d);
});
}

View File

@ -213,20 +213,17 @@ void attack::draw_hex(const map_location& hex)
if (hex == get_dest_hex()) //add symbol to attacker hex
{
auto disp = display::get_singleton();
disp->drawing_buffer_add(layer, get_dest_hex(),
[=, tex = image::get_texture("whiteboard/attack-indicator-src-" + direction_text + ".png", image::HEXED)](const rect& d) {
draw::blit(tex, disp->scaled_to_zoom({d.x, d.y, tex.w(), tex.h()}));
display::get_singleton()->drawing_buffer_add(layer, get_dest_hex(),
[tex = image::get_texture("whiteboard/attack-indicator-src-" + direction_text + ".png", image::HEXED)](const rect& d) {
draw::blit(tex, d);
});
}
else if (hex == target_hex_) //add symbol to defender hex
{
auto disp = display::get_singleton();
disp->drawing_buffer_add(layer, target_hex_,
[=, tex = image::get_texture("whiteboard/attack-indicator-dst-" + direction_text + ".png", image::HEXED)](const rect& d) {
draw::blit(tex, disp->scaled_to_zoom({d.x, d.y, tex.w(), tex.h()}));
display::get_singleton()->drawing_buffer_add(layer, target_hex_,
[tex = image::get_texture("whiteboard/attack-indicator-dst-" + direction_text + ".png", image::HEXED)](const rect& d) {
draw::blit(tex, d);
});
}
}

View File

@ -144,11 +144,9 @@ void suppose_dead::draw_hex(const map_location& hex)
//@todo: Possibly use a different layer
const display::drawing_layer layer = display::LAYER_ARROWS;
auto disp = display::get_singleton();
disp->drawing_buffer_add(
layer, loc_, [=, tex = image::get_texture("whiteboard/suppose_dead.png", image::HEXED)](const rect& d) {
draw::blit(tex, disp->scaled_to_zoom({d.x, d.y, tex.w(), tex.h()}));
display::get_singleton()->drawing_buffer_add(
layer, loc_, [tex = image::get_texture("whiteboard/suppose_dead.png", image::HEXED)](const rect& d) {
draw::blit(tex, d);
});
}