31 #ifndef CRAB_RECTANGLE_H 32 #define CRAB_RECTANGLE_H 34 #include "crab/Line.h" 35 #include "crab/vectors.h" 49 Rect(
int X = 0,
int Y = 0,
int W = 0,
int H = 0) {
56 bool load(rapidxml::xml_node<char> *node,
const bool &echo =
true,
const Common::String &x_name =
"x",
60 bool collide(
Rect box)
const;
63 void extend(
Rect box);
69 Direction resolveX(
Rect collider);
72 Direction resolveY(
Rect collider);
75 bool contains(
int x1,
int y1) {
76 return (x1 > x && x1 < x + w && y1 > y && y1 < y + h);
80 return contains(v.x, v.y);
84 bool contains(
Rect box) {
85 return (x < box.x && x + w > box.x + box.w && y < box.y && y + h > box.y + box.h);
89 void flip(
const TextureFlipType &flip,
const Vector2i &axis);
92 void draw(
const int &xOffset = 0,
const int &yOffset = 0,
const uint8 &r = 0,
const uint8 &g = 0,
const uint8 &b = 0,
const uint8 &a = 255);
95 bool operator==(
const Rect &r) {
return r.x == x && r.y == y && r.w == w && r.h == h; }
98 void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root,
const char *name);
103 #endif // CRAB_RECTANGLE_H
Definition: Rectangle.h:42
Definition: moveeffect.h:37