00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef GCN_RECTANGLE_HPP
00056 #define GCN_RECTANGLE_HPP
00057
00058 #include "guichan/platform.h"
00059
00060 namespace gcn
00061 {
00065 class GCN_CORE_DECLSPEC Rectangle
00066 {
00067 public:
00068
00072 Rectangle();
00073
00082 Rectangle(int x, int y, int width, int height);
00083
00092 void setAll(int x, int y, int width, int height);
00093
00099 bool intersect(const Rectangle& rectangle);
00100 bool intersect(const Rectangle& rectangle) const
00101 {
00102 return !(rectangle.x > x + width ||
00103 rectangle.y > y + height ||
00104 x > rectangle.x + rectangle.width ||
00105 y > rectangle.y + rectangle.height);
00106 }
00107
00114 bool isPointInRect(int x, int y) const;
00115
00116 int x;
00117 int y;
00118 int width;
00119 int height;
00120 };
00121 }
00122
00123 #endif // end GCN_RECTANGEL_HPP