Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed APDS_9960 mbed-rtos
Diff: src/cMatrice.cpp
- Revision:
- 10:9ef3f520ff6c
- Parent:
- 9:6f3d8b714a59
- Child:
- 11:c37922a0a915
--- a/src/cMatrice.cpp Wed Apr 06 21:53:55 2016 +0000
+++ b/src/cMatrice.cpp Thu Apr 07 15:24:07 2016 +0000
@@ -43,10 +43,6 @@
}
// SETTER
-void cMatrice::updateMatrice(cForme &f)
-{
-
-}
void cMatrice::setCol(unsigned char c){
_col = c;
@@ -58,19 +54,17 @@
// METHODES
-void cMatrice::envoyerMatrice()
-{
-
-}
// Paramètres:
// f: Forme à afficher
// c: Couleur
-void cMatrice::afficherForme(cForme &f, unsigned char c)
+void cMatrice::afficherForme(cForme* f, unsigned char c)
{
+ _pForme = f;
// Changement de couleur des Leds
for (int i = 0; i < 4; i++) {
- _matrice[f.getLed(i).getPositionX()][f.getLed(i).getPositionY()] = c;
+ _matrice[_pForme->getLed(i).getPositionX()][_pForme->getLed(i).getPositionY()] = c;
+ _pForme->getLed(i).setCouleur(c);
}
}
@@ -87,4 +81,17 @@
_matrice[0][0] = LED_ROUGE;
}
-
+int cMatrice::updateMatrice()
+{
+
+ // 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;
+ }
+ // Affichage de la nouvelle position
+ afficherForme(_pForme, _pForme->getLed(1).getCouleur());
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ // Controle de la collision avec les bords
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ return 1;
+}