Rename rect::pos() to origin()

This commit is contained in:
Charles Dang 2024-10-25 00:09:07 -04:00
parent 5ab73a51fd
commit ec7679d07f
3 changed files with 7 additions and 7 deletions

View File

@ -642,7 +642,7 @@ const display::rect_of_hexes display::hexes_under_rect(const rect& r) const
}
// translate rect coordinates from screen-based to map_area-based
auto [x, y] = viewport_origin_ - map_area().pos() + r.pos();
auto [x, y] = viewport_origin_ - map_area().origin() + r.origin();
// we use the "double" type to avoid important rounding error (size of an hex!)
// we will also need to use std::floor to avoid bad rounding at border (negative values)
double tile_width = hex_width();

View File

@ -61,7 +61,7 @@ public:
{}
// subcomponent access
constexpr point pos() const { return {x, y}; }
constexpr point origin() const { return {x, y}; }
constexpr point size() const { return {w, h}; }
// Comparisons

View File

@ -315,12 +315,12 @@ bool update_framebuffer()
rect active_area = to_output(draw_area());
if (active_area.size() != osize) {
LOG_DP << "render target offset: LT " << active_area.pos() << " RB "
<< osize - active_area.size() - active_area.pos();
LOG_DP << "render target offset: LT " << active_area.origin() << " RB "
<< osize - active_area.size() - active_area.origin();
// Translate active_area into display coordinates as input_area_
input_area_ = {
(active_area.pos() * wsize) / osize,
(active_area.size() * wsize) / osize
(active_area.origin() * wsize) / osize,
(active_area.origin() * wsize) / osize
};
LOG_DP << "input area: " << input_area_;
}
@ -468,7 +468,7 @@ rect to_output(const rect& r)
// Multiply r by integer scale, adding draw_offset to the position.
point dsize = current_render_target_.draw_size();
point osize = current_render_target_.get_raw_size();
point pos = (r.pos() * (osize / dsize)) + draw_offset();
point pos = (r.origin() * (osize / dsize)) + draw_offset();
point size = r.size() * (osize / dsize);
return {pos, size};
}