Rectangle class
Dependents: FollowMeBot FollowMeBot FollowMeBot3 FollowMeBot
Fork of Rectangle by
Revision 2:087e0b0b526c, committed 2013-11-25
- Comitter:
- dhamilton31
- Date:
- Mon Nov 25 19:54:02 2013 +0000
- Parent:
- 1:d9c0709ba2ce
- Commit message:
- No edit
Changed in this revision
Rectangle.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d9c0709ba2ce -r 087e0b0b526c Rectangle.cpp --- a/Rectangle.cpp Mon Nov 18 21:09:00 2013 +0000 +++ b/Rectangle.cpp Mon Nov 25 19:54:02 2013 +0000 @@ -2,41 +2,51 @@ #include "Rectangle.h" -Rectangle :: Rectangle(int x,int y, int xx, int yy){ - x1 = x; - x2 = xx; - y1 = y; - y2 = yy; - } +Rectangle :: Rectangle(int x,int y, int xx, int yy) +{ + x1 = x; + x2 = xx; + y1 = y; + y2 = yy; +} -bool Rectangle :: is_touch(int x_touch , int y_touch){ - if(x_touch >= x1 && x_touch <= x2) - if(y_touch >= y1 && y_touch <= y2) +bool Rectangle :: is_touch(int x_touch , int y_touch) +{ + if(x_touch >= x1 && x_touch <= x2) { + if(y_touch >= y1 && y_touch <= y2) { return true; - return false; - } - - -int Rectangle :: getX1(){ - return x1; + } } - -int Rectangle :: getX2(){ + return false; +} + + +int Rectangle :: getX1() +{ + return x1; +} + +int Rectangle :: getX2() +{ return x2; - } - -int Rectangle :: getY1(){ +} + +int Rectangle :: getY1() +{ return y1; - } - -int Rectangle :: getY2(){ +} + +int Rectangle :: getY2() +{ return y2; - } - -int Rectangle :: getCenterX(){ +} + +int Rectangle :: getCenterX() +{ return x1 + (x2-x1)/2; - } - -int Rectangle :: getCenterY(){ +} + +int Rectangle :: getCenterY() +{ return y1 + (y2-y1)/2; - } \ No newline at end of file +} \ No newline at end of file