main.cpp@0:a8b629c2c441, 2011-05-03 (annotated)
- Committer:
- projetremote
- Date:
- Tue May 03 13:32:13 2011 +0000
- Revision:
- 0:a8b629c2c441
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
projetremote | 0:a8b629c2c441 | 1 | /*#include "mbed.h" |
projetremote | 0:a8b629c2c441 | 2 | #include "Objet.h" |
projetremote | 0:a8b629c2c441 | 3 | |
projetremote | 0:a8b629c2c441 | 4 | Objet :: Objet(int x ,int y, int width , int height){ |
projetremote | 0:a8b629c2c441 | 5 | Origin['x'] = x; |
projetremote | 0:a8b629c2c441 | 6 | Origin['y'] = y; |
projetremote | 0:a8b629c2c441 | 7 | End['x'] = x + width; |
projetremote | 0:a8b629c2c441 | 8 | End['y'] = y + height; |
projetremote | 0:a8b629c2c441 | 9 | } |
projetremote | 0:a8b629c2c441 | 10 | |
projetremote | 0:a8b629c2c441 | 11 | Objet :: is_touch(int x_touch , int y_touch){ |
projetremote | 0:a8b629c2c441 | 12 | if(x_touch >= Origin['x'] && x_touch <= End['x']) // Si dans l'objet en x |
projetremote | 0:a8b629c2c441 | 13 | if(y_touch >= Origin['y'] && y_touch <= End['y']) // Et si dans l'objet en y |
projetremote | 0:a8b629c2c441 | 14 | return true; |
projetremote | 0:a8b629c2c441 | 15 | return false; |
projetremote | 0:a8b629c2c441 | 16 | } |
projetremote | 0:a8b629c2c441 | 17 | |
projetremote | 0:a8b629c2c441 | 18 | Objet :: depladement(int new_x,int new_y){ |
projetremote | 0:a8b629c2c441 | 19 | int width = End['x'] - Origin['x']; |
projetremote | 0:a8b629c2c441 | 20 | int height = End['y'] - Origin['y']; |
projetremote | 0:a8b629c2c441 | 21 | Origin['x'] = new_x; |
projetremote | 0:a8b629c2c441 | 22 | Origin['y'] = new_y; |
projetremote | 0:a8b629c2c441 | 23 | End['x'] = new_x + width; |
projetremote | 0:a8b629c2c441 | 24 | End['y'] = new_y + height; |
projetremote | 0:a8b629c2c441 | 25 | } |
projetremote | 0:a8b629c2c441 | 26 | |
projetremote | 0:a8b629c2c441 | 27 | Objet :: changement(int new_width, int new_height){ |
projetremote | 0:a8b629c2c441 | 28 | End['x'] = Origin['x'} + new_width; |
projetremote | 0:a8b629c2c441 | 29 | End['y'] = Origin'y'] + new_height; |
projetremote | 0:a8b629c2c441 | 30 | } |
projetremote | 0:a8b629c2c441 | 31 | |
projetremote | 0:a8b629c2c441 | 32 | */ |