00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00028 #ifndef SDLMM_SRECT_H
00029 #define SDLMM_SRECT_H
00030 #include "sdlmm_spoint.h"
00031
00032 namespace SDLmm {
00043 class SRect : public SDL_Rect {
00044 public:
00047 SRect();
00048
00051
00052 SRect(const SRect& rect);
00053
00055
00056 SRect(const SDL_Rect& rect);
00057
00059
00063 SRect(const SPoint& point);
00064
00067
00071 SRect(const SPoint &upper_left_point,
00072 const SPoint &bottom_right_point);
00073
00076
00083 SRect(const SPoint &point, Uint16 nw, Uint16 nh);
00084
00086
00090 SRect(Sint16 nx, Sint16 ny, Uint16 nw, Uint16 nh);
00091
00093
00097 SRect(Uint16 nw, Uint16 nh);
00098
00100 SRect& operator=(const SDL_Rect& rect) {
00101 if(this == &rect) return *this;
00102 x = rect.x; y = rect.y;
00103 w = rect.w; h = rect.h;
00104 return *this;
00105 }
00106
00108
00111 bool operator==(const SDL_Rect& rect) const {
00112 return ((x == rect.x) && (y == rect.y) &&
00113 (w == rect.w) && (h == rect.h));
00114 }
00115
00117
00118 SPoint GetUpperLeft() const { return SPoint(x, y); }
00120
00121 SPoint GetUpperRight() const { return SPoint(x+w, y); }
00123
00124 SPoint GetBottomLeft() const { return SPoint(x, y+h); }
00126
00127 SPoint GetBottomRight() const { return SPoint(x+w, y+h); }
00128
00129 };
00130 }
00131
00132 #endif // SDLMM_SRECT_H
00133