Mini projet LOO
Dependencies: mbed APDS_9960 mbed-rtos
Home du projet
Diff: src/cForme.cpp
- Revision:
- 7:4b283e36b147
- Parent:
- 4:b7a46af55574
- Child:
- 8:92d0c4961a16
diff -r d6b0bf27bac6 -r 4b283e36b147 src/cForme.cpp --- a/src/cForme.cpp Thu Mar 31 11:24:34 2016 +0000 +++ b/src/cForme.cpp Fri Apr 01 14:30:30 2016 +0000 @@ -1,40 +1,71 @@ #include "cForme.h" -cForme::cForme(){ - _orientation = 1; // Orientation par défaut - _positionX = 0; - _positionY = 0; +cForme::cForme() { + +} + +cForme::~cForme(){ + +} +// GETTERS + +unsigned char cForme::getOrientation() { + return _orientation; } - - // GETTERS +unsigned char cForme::getPositionX() { + return _positionX; +} -unsigned char cForme::getOrientation(){ - return _orientation; +unsigned char cForme::getPositionY() { + return _positionY; } -unsigned char cForme::getPositionX(){ - return _positionX; +cLed cForme::getLed(unsigned char i) { + return _Leds[i]; +} + +// SETTERS +void cForme::setOrientation(unsigned char orientation) { + _orientation = orientation; } -unsigned char cForme::getPositionY(){ - return _positionY; +void cForme::setPositionX(unsigned char x) { + _positionX = x; +} +void cForme::setPositionY(unsigned char y) { + _positionY = y; } -cLed cForme::getLed(unsigned char i){ - return _Leds[i]; +// METHODES + +// Description: +// Décalage d'1 case vers le bas +void cForme::deplacementBas() { + setPositionY(getPositionY() + 1); + for (unsigned char i = 0; i < 3; i++) { + getLed(i).setPositionY(getLed(i).getPositionY() + 1); + } } - // SETTERS -void cForme::setOrientation(unsigned char orientation){ - _orientation = orientation; -} + // Description: + // Décalage d'1 case vers le bas + void cForme::deplacementDroite() { + setPositionX(getPositionX() + 1); + for (unsigned char i = 0; i < 3; i++) { + getLed(i).setPositionX(getLed(i).getPositionX() + 1); + } + } -void cForme::setPositionX(unsigned char x){ - _positionX = x; + // Description: + // Décalage d'1 case vers le bas + void cForme::deplacementGauche() { + setPositionX(getPositionX() - 1); + for (unsigned char i = 0; i < 3; i++) { + getLed(i).setPositionX(getLed(i).getPositionX() - 1); + } + } + +void cForme::rotationHoraire(){ + } -void cForme::setPositionY(unsigned char y){ - _positionY = y; -} - -