Mini projet LOO
Dependencies: mbed APDS_9960 mbed-rtos
Home du projet
src/cForme.cpp@8:92d0c4961a16, 2016-04-06 (annotated)
- Committer:
- Willheisen
- Date:
- Wed Apr 06 15:41:24 2016 +0000
- Revision:
- 8:92d0c4961a16
- Parent:
- 7:4b283e36b147
- Child:
- 9:6f3d8b714a59
ajout de la classe cJeu avec les m?thodes initialiser et g?n?ration al?atoire de pi?ce
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
clementdoreau | 0:b2acac6abf2b | 1 | #include "cForme.h" |
clementdoreau | 0:b2acac6abf2b | 2 | |
clementdoreau | 7:4b283e36b147 | 3 | cForme::cForme() { |
clementdoreau | 7:4b283e36b147 | 4 | |
clementdoreau | 7:4b283e36b147 | 5 | } |
clementdoreau | 7:4b283e36b147 | 6 | |
clementdoreau | 7:4b283e36b147 | 7 | cForme::~cForme(){ |
clementdoreau | 7:4b283e36b147 | 8 | |
clementdoreau | 7:4b283e36b147 | 9 | } |
clementdoreau | 7:4b283e36b147 | 10 | // GETTERS |
clementdoreau | 7:4b283e36b147 | 11 | |
clementdoreau | 7:4b283e36b147 | 12 | unsigned char cForme::getOrientation() { |
clementdoreau | 7:4b283e36b147 | 13 | return _orientation; |
clementdoreau | 0:b2acac6abf2b | 14 | } |
clementdoreau | 0:b2acac6abf2b | 15 | |
clementdoreau | 7:4b283e36b147 | 16 | unsigned char cForme::getPositionX() { |
clementdoreau | 7:4b283e36b147 | 17 | return _positionX; |
clementdoreau | 7:4b283e36b147 | 18 | } |
clementdoreau | 1:ab5f440f4156 | 19 | |
clementdoreau | 7:4b283e36b147 | 20 | unsigned char cForme::getPositionY() { |
clementdoreau | 7:4b283e36b147 | 21 | return _positionY; |
clementdoreau | 0:b2acac6abf2b | 22 | } |
clementdoreau | 0:b2acac6abf2b | 23 | |
clementdoreau | 7:4b283e36b147 | 24 | cLed cForme::getLed(unsigned char i) { |
clementdoreau | 7:4b283e36b147 | 25 | return _Leds[i]; |
clementdoreau | 7:4b283e36b147 | 26 | } |
clementdoreau | 7:4b283e36b147 | 27 | |
clementdoreau | 7:4b283e36b147 | 28 | // SETTERS |
clementdoreau | 7:4b283e36b147 | 29 | void cForme::setOrientation(unsigned char orientation) { |
clementdoreau | 7:4b283e36b147 | 30 | _orientation = orientation; |
clementdoreau | 1:ab5f440f4156 | 31 | } |
clementdoreau | 1:ab5f440f4156 | 32 | |
clementdoreau | 7:4b283e36b147 | 33 | void cForme::setPositionX(unsigned char x) { |
clementdoreau | 7:4b283e36b147 | 34 | _positionX = x; |
clementdoreau | 7:4b283e36b147 | 35 | } |
clementdoreau | 7:4b283e36b147 | 36 | void cForme::setPositionY(unsigned char y) { |
clementdoreau | 7:4b283e36b147 | 37 | _positionY = y; |
clementdoreau | 0:b2acac6abf2b | 38 | } |
clementdoreau | 0:b2acac6abf2b | 39 | |
clementdoreau | 7:4b283e36b147 | 40 | // METHODES |
clementdoreau | 7:4b283e36b147 | 41 | |
clementdoreau | 7:4b283e36b147 | 42 | // Description: |
clementdoreau | 7:4b283e36b147 | 43 | // Décalage d'1 case vers le bas |
clementdoreau | 7:4b283e36b147 | 44 | void cForme::deplacementBas() { |
clementdoreau | 7:4b283e36b147 | 45 | setPositionY(getPositionY() + 1); |
clementdoreau | 7:4b283e36b147 | 46 | for (unsigned char i = 0; i < 3; i++) { |
clementdoreau | 7:4b283e36b147 | 47 | getLed(i).setPositionY(getLed(i).getPositionY() + 1); |
clementdoreau | 7:4b283e36b147 | 48 | } |
clementdoreau | 0:b2acac6abf2b | 49 | } |
clementdoreau | 0:b2acac6abf2b | 50 | |
clementdoreau | 7:4b283e36b147 | 51 | // Description: |
clementdoreau | 7:4b283e36b147 | 52 | // Décalage d'1 case vers le bas |
clementdoreau | 7:4b283e36b147 | 53 | void cForme::deplacementDroite() { |
clementdoreau | 7:4b283e36b147 | 54 | setPositionX(getPositionX() + 1); |
clementdoreau | 7:4b283e36b147 | 55 | for (unsigned char i = 0; i < 3; i++) { |
clementdoreau | 7:4b283e36b147 | 56 | getLed(i).setPositionX(getLed(i).getPositionX() + 1); |
clementdoreau | 7:4b283e36b147 | 57 | } |
clementdoreau | 7:4b283e36b147 | 58 | } |
clementdoreau | 0:b2acac6abf2b | 59 | |
clementdoreau | 7:4b283e36b147 | 60 | // Description: |
clementdoreau | 7:4b283e36b147 | 61 | // Décalage d'1 case vers le bas |
clementdoreau | 7:4b283e36b147 | 62 | void cForme::deplacementGauche() { |
clementdoreau | 7:4b283e36b147 | 63 | setPositionX(getPositionX() - 1); |
clementdoreau | 7:4b283e36b147 | 64 | for (unsigned char i = 0; i < 3; i++) { |
clementdoreau | 7:4b283e36b147 | 65 | getLed(i).setPositionX(getLed(i).getPositionX() - 1); |
clementdoreau | 7:4b283e36b147 | 66 | } |
clementdoreau | 7:4b283e36b147 | 67 | } |
clementdoreau | 7:4b283e36b147 | 68 | |
Willheisen | 8:92d0c4961a16 | 69 | void cForme::rotationHoraire(){} |