| 1234567891011121314151617181920212223242526272829303132333435 |
- //
- // Bounds.h
- // ncurses-wrapper
- //
- // Created by Sam Jaffe on 7/23/24.
- //
- #pragma once
- namespace curses {
- struct Bounds {
- int width;
- int height;
- };
- struct Offset {
- int x;
- int y;
- };
- struct Position {
- friend Position operator+(Position const &lhs, Offset const &rhs) {
- return {lhs.x + rhs.x, lhs.y + rhs.y};
- }
- friend Position operator-(Position const &lhs, Offset const &rhs) {
- return {lhs.x - rhs.x, lhs.y - rhs.y};
- }
-
- Position only_x() const { return {x, 0}; }
- Position only_y() const { return {0, y}; }
- int x;
- int y;
- };
- }
|