7 #include "external/json/json.h"
18 Rect() : pos(0, 0), w(0), h(0) {
27 Rect(T pX, T pY, T pW, T pH) : pos(pX, pY), w(pW), h(pH) {
62 void Set(T pX, T pY, T pW, T pH){
132 Set(val[
"x"].asInt(), val[
"y"].asInt(),
133 val[
"w"].asInt(), val[
"h"].asInt());
137 return (pos.x == r.
X() && pos.y == r.
Y()
138 && w == r.w && h == r.h);
145 return Rect<T>(pos.x + v.x, pos.y + v.y, w, h);
148 return Rect<T>(pos.x - v.x, pos.y - v.y, w, h);
151 operator SDL_Rect()
const{
167 operator std::string()
const {
169 s <<
"Rect: (" << (std::string)pos
170 <<
", w: " << w <<
", h: " << h <<
")";