BastatDoreau / Mbed 2 deprecated MoveYourTetris

Dependencies:   mbed APDS_9960 mbed-rtos

Dependents:   MoveYourTetris_OK

Revision:
30:c647da947bd9
Parent:
29:95469b25e187
Child:
32:029962133529
diff -r 95469b25e187 -r c647da947bd9 src/cMatrice.cpp
--- a/src/cMatrice.cpp	Wed Apr 20 15:09:43 2016 +0000
+++ b/src/cMatrice.cpp	Thu Apr 21 12:33:58 2016 +0000
@@ -9,13 +9,13 @@
     _col = 0;
 }
 
-cMatrice::cMatrice(unsigned int c, unsigned int l)
+cMatrice::cMatrice(int l, int c)
 {
     _lig = l;
     _col = c;
-    _matrice = new unsigned int*[_lig];
+    _matrice = new int*[_lig];
     for(unsigned int i = 0; i < _lig; i++) {
-        _matrice[i] = new unsigned int[_col];
+        _matrice[i] = new int[_col];
     }
     clear();
 }
@@ -23,24 +23,24 @@
 // DESTRUCTEUR
 cMatrice::~cMatrice()
 {
-    for(unsigned int i = 0; i < _lig; i++) {
+    for(int i = 0; i < _lig; i++) {
         delete[] _matrice[i];
         delete[] _matrice;
     }
 }
 
 // GETTER
-unsigned int cMatrice::getValTab(unsigned int l, unsigned int c)
+int cMatrice::getValTab(int l, int c)
 {
     return _matrice[l][c];
 }
 
-unsigned int cMatrice::getCol()
+int cMatrice::getCol()
 {
     return _col;
 }
 
-unsigned int cMatrice::getLig()
+int cMatrice::getLig()
 {
     return _lig;
 }
@@ -51,16 +51,16 @@
 }
 // SETTER
 
-void cMatrice::setCol(unsigned int c)
+void cMatrice::setCol(int c)
 {
     _col = c;
 }
 
-void cMatrice::setLig(unsigned int l)
+void cMatrice::setLig(int l)
 {
     _lig = l;
 }
-void cMatrice::setValTab(unsigned int l, unsigned int c, unsigned int coul)
+void cMatrice::setValTab(int l, int c, unsigned int coul)
 {
     _matrice [l][c] = coul;
 }
@@ -76,7 +76,7 @@
     // Changement de couleur des Leds
     for (int i = 0; i < 4; i++) {
         _pForme->getLed(i).setCouleur(c);
-        _matrice[_pForme->getLed(i).getPositionX()][_pForme->getLed(i).getPositionY()] = c;
+        _matrice[_pForme->getLed(i).getPositionY()][_pForme->getLed(i).getPositionX()] = c;
 
     }
 }
@@ -86,8 +86,8 @@
 //  Nettoyage de la matrice, passage à 0 de la valeur de chaque Led
 void cMatrice::clear()
 {
-    for(unsigned int i = 0; i < _lig; i++) {
-        for(unsigned int j = 0; j < _col; j++) {
+    for( int i = 0; i < _lig; i++) {
+        for( int j = 0; j < _col; j++) {
             _matrice[i][j] = LED_NOIR;
         }
     }
@@ -100,7 +100,7 @@
 {
     // On éteint les leds de la pièce
     for (int i = 0; i < 4; i++) {
-        _matrice[_pForme->getLed(i).getOldPositionX()][_pForme->getLed(i).getOldPositionY()] = LED_NOIR;
+        _matrice[_pForme->getLed(i).getOldPositionY()][_pForme->getLed(i).getOldPositionX()] = LED_NOIR;
     }
     // Affichage de la nouvelle position
     afficherForme(_pForme, _pForme->getLed(0).getCouleur());