Dependents: Objet Telecommande_prologue
Revision 0:19fca77774b6, committed 2011-05-03
- Comitter:
- projetremote
- Date:
- Tue May 03 13:32:04 2011 +0000
- Commit message:
Changed in this revision
Rectangle.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 19fca77774b6 Rectangle.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Rectangle.h Tue May 03 13:32:04 2011 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +class Rectangle { +protected : + int Origin[1]; + int End[1]; + int * back; + + +public : + Rectangle(int x,int y, int x2, int y2, int color, int * back); + + bool is_touch(int x_touch, int y_touch); + + bool deplace(int x, int y); + + int getX1(); + + int getX2(); + + int getY1(); + + int getY2(); + + int * getBack(); +}; \ No newline at end of file
diff -r 000000000000 -r 19fca77774b6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 03 13:32:04 2011 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#include "Rectangle.h" + + +Rectangle :: Rectangle(int x,int y, int x2, int y2, int color,int * back_c){ + Origin['x'] = x; + Origin['y'] = y; + End['x'] = x2; + End['y'] = y2; + back = back_c; + } + +bool Rectangle :: is_touch(int x_touch , int y_touch){ + if(x_touch >= Origin['x'] && x_touch <= End['x']) // Si dans l'objet en x + if(y_touch >= Origin['y'] && y_touch <= End['y']) // Et si dans l'objet en y + return true; + return false; + } + +bool Rectangle :: deplace(int x, int y){ + } + +int Rectangle :: getX1(){ + return Origin['x']; + } + +int Rectangle :: getX2(){ + return End['x']; + } + +int Rectangle :: getY1(){ + return Origin['y']; + } + +int Rectangle :: getY2(){ + return End['y']; + } + +int * Rectangle :: getBack(){ + return back; + } \ No newline at end of file