PACMAN_part_2

Dependencies:   mbed LCD_DISCO_F469NI TS_DISCO_F469NI BSP_DISCO_F469NI

Files at this revision

API Documentation at this revision

Comitter:
fab2sn
Date:
Fri Dec 20 15:55:35 2019 +0000
Parent:
2:63af55274d70
Commit message:
base

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Dec 06 14:12:53 2019 +0000
+++ b/main.cpp	Fri Dec 20 15:55:35 2019 +0000
@@ -1,3 +1,5 @@
+/* Comprendre et jouer avec les parametres */
+
 #include "mbed.h"
 #include "LCD_DISCO_F469NI.h"
 #include "TS_DISCO_F469NI.h"
@@ -8,96 +10,8 @@
 
 int main()
 {    
-    Point trianglePoint[3];
-    Point pacmanCenter;
-    int16_t pacmanSize = 64;
-    int16_t pacGumSize = 10;
-    uint8_t i;
-    uint16_t x, y;
-    uint32_t color;
-    TS_StateTypeDef TS_State;
-
-    ts.Init(lcd.GetXSize(), lcd.GetYSize());
-    color = LCD_COLOR_YELLOW;
-
- start:
  
-    /* Eteint la LED */
-    led1 = 1;
-      
-    /* Efface ecran */
     lcd.Clear(LCD_COLOR_BLACK);
     lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"!! PACMAN !!", CENTER_MODE);
    
-    wait(1);
-    
-    /* emplacement initial du pacman */
-    pacmanCenter.X = pacmanSize + 10;
-    pacmanCenter.Y = lcd.GetYSize() / 2;
-    
-    
-    /* Dessine des pacgum */
-    lcd.SetTextColor(LCD_COLOR_RED);
-    for (i = 0; i < 7; i++) {
-      lcd.FillCircle(i * 100 + pacGumSize, pacmanCenter.Y, pacGumSize);
-    }
-    
-    /* boucle d'animation */
-    do
-    {        
-      /* on efface le pacman */
-      lcd.SetTextColor(LCD_COLOR_BLACK);
-      lcd.FillCircle(pacmanCenter.X - 10, pacmanCenter.Y, pacmanSize);
-    
-      /* dessine un rond jaune */
-      lcd.SetTextColor(color);
-      lcd.FillCircle(pacmanCenter.X, pacmanCenter.Y, pacmanSize);
-
-      /* dessine la bouche (triangle noir) */
-      trianglePoint[0].X = pacmanCenter.X;
-      trianglePoint[0].Y = pacmanCenter.Y;
-      
-      trianglePoint[1].X = pacmanCenter.X + pacmanSize;
-      trianglePoint[1].Y = pacmanCenter.Y - pacmanSize;
-      
-      trianglePoint[2].X = pacmanCenter.X + pacmanSize;
-      trianglePoint[2].Y = pacmanCenter.Y + pacmanSize;
-      
-      lcd.SetTextColor(LCD_COLOR_BLACK);
-      lcd.FillPolygon(trianglePoint, 3);
-
-      ts.GetState(&TS_State);      
-      if (TS_State.touchDetected) {
-        x = TS_State.touchX[0];
-        y = TS_State.touchY[0];
-        if ((abs(x - pacmanCenter.X) < 50) & (abs(y - pacmanCenter.Y) < 50)) {
-            if (color == LCD_COLOR_YELLOW)
-                color = LCD_COLOR_BLUE;
-            else
-                color = LCD_COLOR_YELLOW;              
-        }
-      }
-
-      /* on attend un peu */
-      wait(0.02);
-      
-      /* on se prepare a deplacer le pacman */
-      pacmanCenter.X += 10;   
-      
-    } while (pacmanCenter.X + pacmanSize < lcd.GetXSize());
-    /* on continue tant que le pacman n'a pas atteint le bord de l'ecran */
-    
-    /* Affiche le texte */
-    lcd.DisplayStringAt(0, LINE(20), (uint8_t *)"THE END", CENTER_MODE);
-    
-    /* Clignotte la LED */
-    for (i = 0; i < 10; i++) {
-        led1 = !led1;
-        wait(0.05);
-    }
-    
-    wait(1);
-    
-    /* on recommence */
-    goto start;
 }