40 lines
610 B
C++
40 lines
610 B
C++
#ifndef UI_STRUCTS_H
|
|
#define UI_STRUCTS_H
|
|
|
|
#include <cstdint>
|
|
|
|
struct UIPoint {
|
|
|
|
uint16_t x;
|
|
uint16_t y;
|
|
|
|
UIPoint() : x(0), y(0) {;}
|
|
|
|
UIPoint(uint16_t x, uint16_t y) : x(x), y(y) {;}
|
|
|
|
};
|
|
|
|
struct UIRect {
|
|
|
|
uint16_t x;
|
|
uint16_t y;
|
|
|
|
uint16_t w;
|
|
uint16_t h;
|
|
|
|
UIRect() : x(0), y(0), w(0), h(0) {;}
|
|
|
|
UIRect(const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h) : x(x), y(y), w(w), h(h) {;}
|
|
|
|
bool contains(const uint16_t x, const uint16_t y) const {
|
|
return
|
|
(this->x <= x) &&
|
|
(this->y <= y) &&
|
|
(x <= this->x+this->w) &&
|
|
(y <= this->y+this->h);
|
|
}
|
|
|
|
};
|
|
|
|
#endif // UI_STRUCTS_H
|