Mini projet LOO

Dependencies:   mbed APDS_9960 mbed-rtos

Dependents:   MoveYourTetris_OK

Home du projet

src/cCarre.cpp

Committer:
Willheisen
Date:
2016-04-24
Revision:
40:08490d120ec4
Parent:
12:7afdbc7465ac
Child:
29:95469b25e187

File content as of revision 40:08490d120ec4:

// Définition de la classe Carré

#include "cCarre.h"

cCarre::cCarre() {
	// variables à 0
	_positionX = 0;
	_positionY = 0;
	_orientation = 1;
	// Positionnement des leds
	//   |0|1|
	//   |2|3|
	_Leds[0].setPositionX(_positionX);
	_Leds[0].setPositionY(_positionY);
	_Leds[1].setPositionX(_positionX + 1);
	_Leds[1].setPositionY(_positionY);
	_Leds[2].setPositionX(_positionX);
	_Leds[2].setPositionY(_positionY + 1);
	_Leds[3].setPositionX(_positionX + 1);
	_Leds[3].setPositionY(_positionY + 1);
    for(unsigned char i = 0; i<4; i++) {
        _Leds[i].setOldPositionX(_Leds[i].getPositionX());
    }
    for(unsigned char i = 0; i<4; i++) {
        _Leds[i].setOldPositionY(_Leds[i].getPositionY());
    }
    _typeForme = 1;
}

cCarre::cCarre(unsigned char x, unsigned char y) {
	// variables à 0
	_positionX = x;
	_positionY = y;
	_orientation = 1;
	// Positionnement des leds
	//   |0|1|
	//   |2|3|
	_Leds[0].setPositionX(_positionX);
	_Leds[0].setPositionY(_positionY);
	_Leds[1].setPositionX(_positionX + 1);
	_Leds[1].setPositionY(_positionY);
	_Leds[2].setPositionX(_positionX);
	_Leds[2].setPositionY(_positionY + 1);
	_Leds[3].setPositionX(_positionX + 1);
	_Leds[3].setPositionY(_positionY + 1);
    for(unsigned char i = 0; i<4; i++) {
        _Leds[i].setOldPositionX(_Leds[i].getPositionX());
    }
    for(unsigned char i = 0; i<4; i++) {
        _Leds[i].setOldPositionY(_Leds[i].getPositionY());
    }
    _typeForme = 1;
}


void cCarre::rotationHoraire() {
	//Rien dans ce cas

}