Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- File List

# rect.h

    00001 #ifndef _RECT_H_
    00002 #define _RECT_H_
    00003
    00004 #include <nds.h>
    00005 #include "woopsiarray.h"
    00006
    00007 namespace WoopsiUI {
    00008
    00012         class Rect {
    00013         public:
    00014                 s16 x;
    00015                 s16 y;
    00016                 s32 width;
    00017                 s32 height;
    00022                 Rect();
    00023
    00031                 Rect(s16 x, s16 y, s32 width, s32 height);
    00032
    00037                 Rect(const Rect& rect);
    00038
    00047                 static Rect fromCoordinates(s16 x1, s16 y1, s16 x2, s16 y2);
    00048
    00053                 inline s16 getX() const { return x; };
    00054
    00059                 inline s16 getY() const { return y; };
    00060
    00065                 inline s32 getWidth() const { return width; };
    00066
    00071                 inline s32 getHeight() const { return height; };
    00072
    00077                 inline void setX(s16 x) { this->x = x; };
    00078
    00083                 inline void setY(s16 y) { this->y = y; };
    00084
    00089                 inline void setWidth(s32 width) { this->width = width; };
    00090
    00095                 inline void setHeight(s32 height) { this->height = height; };
    00096
    00104                 void setX2(s16 x2);
    00105
    00113                 void setY2(s16 y2);
    00114
    00119                 inline s16 getX2() const { return x + (width - 1); };
    00120
    00125                 inline s16 getY2() const { return y + (height - 1); };
    00126
    00133                 bool hasDimensions() const;
    00134
    00141                 void getIntersect(const Rect& rect, Rect& dest) const;
    00142
    00149                 void getAddition(const Rect& rect, Rect& dest) const;
    00150
    00154                 void clipToIntersect(const Rect& rect);
    00155
    00160                 void expandToInclude(const Rect& rect);
    00161
    00167                 bool intersects(const Rect& rect) const;
    00168
    00175                 bool contains(s16 x, s16 y) const;
    00176
    00181                 void copyTo(Rect& dest) const;
    00182
    00195                 bool splitIntersection(const Rect& rect, Rect& intersection, WoopsiArray<Rect>* remainderRects) const;
    00196
    00203                 Rect operator&(const Rect& rect);
    00204
    00212                 Rect operator+(const Rect& rect);
    00213
    00220                 bool operator==(const Rect& rect);
    00221
    00228                 bool operator!=(const Rect& rect);
    00229         };
    00230 }
    00231
    00232 #endif