1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
class rectangle
{
private:
int x,y,brx,bry,w,h;
public:
rectangle(int xpos , int ypos , int width , int height):
x(xpos), y(ypos), brx(xpos + width - 1), bry(ypos + height - 1), w(width), h(height){}
inline bool Overlaps(const rectangle& r);
int X() {return x;}
int Y() {return y;}
int BRX() {return brx;}
int BRY() {return bry;}
int W() {return w;}
int H() {return h;}
};
inline bool rectangle::Overlaps(const rectangle& r)
{
return !(((x > r.brx) || (brx < r.x)) || ((y > r.bry) || (bry < r.y)));
}
class Box
{
public:
rectangle area;
ALLEGRO_BITMAP* Image;
bool IsBroken;
Box(int xpos , int ypos , int width , int height , ALLEGRO_BITMAP* Image):
area(xpos,ypos,width,height), Image(Image), IsBroken(false){}
};
class Level
{
public:
vector<Box> boxes;
};
Level LevelOne;
|