display

Layout and Rendering TUI library
git clone git://git.dimitrijedobrota.com/display.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

commit27906dfc585112bf4f4e3ca7c09034524a5045bb
parent7118c82d1addda5c08838c787928aa8be693894b
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateWed, 5 Mar 2025 14:54:53 +0100

Add comparison operators to pos_t

Diffstat:
Minclude/display/types.hpp|+++++++

1 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/include/display/types.hpp b/include/display/types.hpp

@@ -198,6 +198,13 @@ struct pos_t

pos_t operator+(dim_t rhs) const { return {x + rhs.width, y + rhs.height}; }
bool operator==(pos_t rhs) const { return x == rhs.x && y == rhs.y; }
bool operator!=(pos_t rhs) const { return x != rhs.x || y != rhs.y; }
bool operator<(pos_t rhs) const { return x < rhs.x && y < rhs.y; }
bool operator>(pos_t rhs) const { return x > rhs.x && y > rhs.y; }
bool operator<=(pos_t rhs) const { return x <= rhs.x && y <= rhs.y; }
bool operator>=(pos_t rhs) const { return x >= rhs.x && y >= rhs.y; }
xpos_t x;
ypos_t y;
};