1 #if !defined(_BTK_RECT_HPP_) 3 #include <SDL2/SDL_rect.h> 10 struct Rect:
public SDL_Rect{
12 Rect(
const SDL_Rect &r){
18 Rect(
int x,
int y,
int w,
int h){
25 bool empty()
const noexcept{
26 return SDL_RectEmpty(
this);
29 bool has_point(
const SDL_Point &p)
const noexcept{
30 return SDL_PointInRect(&p,
this);
32 bool has_point(
int x,
int y)
const noexcept{
37 return SDL_PointInRect(&p,
this);
40 bool operator ==(
const SDL_Rect& r)
const noexcept{
41 return SDL_RectEquals(
this,&r);
43 bool operator !=(
const SDL_Rect& r)
const noexcept{
44 return not SDL_RectEquals(
this,&r);
53 FRect(
float x,
float y,
float w,
float h){
62 bool empty()
const noexcept{
63 return w <= 0 or h <= 0;
65 operator Rect()
const noexcept{
73 bool operator ==(
const FRect &r){
74 return x == r.x and y == r.y and w == r.w and h == r.h;
76 bool operator !=(
const FRect &r){
77 return not operator ==(r);
87 Point(
const SDL_Point &p){
91 bool operator ==(
const SDL_Point &p)
const noexcept{
92 return x == p.x and y == p.y;
94 bool operator !=(
const SDL_Point &p)
const noexcept{
95 return x != p.x or y != p.y;
109 #endif // _BTK_RECT_HPP_ a SDL_Rect with methods
Definition: rect.hpp:10
This header include many useful containers.
Definition: async.hpp:7
Size of a Widget or Window.
Definition: rect.hpp:104