This code contains the game Starship designed for the STM32F429i-DISC1 board. It requires a keyboard to play.

Dependencies:   Starship LCD_DISCO_F429ZI USBHost mbed

Dependents:   Starship

Committer:
Oshyrath
Date:
Sun Sep 17 17:05:27 2017 +0000
Revision:
0:c9afe145b57b
Child:
1:527a11035e0b
This is the first push for Starship game for STM32F429i-DISC1.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Oshyrath 0:c9afe145b57b 1 #include "mbed.h"
Oshyrath 0:c9afe145b57b 2 #include "LCD_DISCO_F429ZI.h"
Oshyrath 0:c9afe145b57b 3 #include "Enemy.h"
Oshyrath 0:c9afe145b57b 4
Oshyrath 0:c9afe145b57b 5 LCD_DISCO_F429ZI lcd;
Oshyrath 0:c9afe145b57b 6
Oshyrath 0:c9afe145b57b 7 DigitalOut led1(LED1);
Oshyrath 0:c9afe145b57b 8
Oshyrath 0:c9afe145b57b 9 int main()
Oshyrath 0:c9afe145b57b 10 {
Oshyrath 0:c9afe145b57b 11 led1 = 1;
Oshyrath 0:c9afe145b57b 12
Oshyrath 0:c9afe145b57b 13 BSP_LCD_SetFont(&Font20);
Oshyrath 0:c9afe145b57b 14 lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE);
Oshyrath 0:c9afe145b57b 15 wait(1);
Oshyrath 0:c9afe145b57b 16
Oshyrath 0:c9afe145b57b 17 while(1)
Oshyrath 0:c9afe145b57b 18 {
Oshyrath 0:c9afe145b57b 19 lcd.Clear(LCD_COLOR_BLUE);
Oshyrath 0:c9afe145b57b 20 lcd.SetBackColor(LCD_COLOR_BLUE);
Oshyrath 0:c9afe145b57b 21 lcd.SetTextColor(LCD_COLOR_WHITE);
Oshyrath 0:c9afe145b57b 22 wait(0.3);
Oshyrath 0:c9afe145b57b 23 lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"DISCOVERY", CENTER_MODE);
Oshyrath 0:c9afe145b57b 24 lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"STM32F429ZI", CENTER_MODE);
Oshyrath 0:c9afe145b57b 25 wait(1);
Oshyrath 0:c9afe145b57b 26
Oshyrath 0:c9afe145b57b 27 lcd.Clear(LCD_COLOR_GREEN);
Oshyrath 0:c9afe145b57b 28
Oshyrath 0:c9afe145b57b 29 lcd.SetTextColor(LCD_COLOR_BLUE);
Oshyrath 0:c9afe145b57b 30 lcd.FillRect(10, 20, 50, 50);
Oshyrath 0:c9afe145b57b 31 wait(0.1);
Oshyrath 0:c9afe145b57b 32 lcd.SetTextColor(LCD_COLOR_BROWN);
Oshyrath 0:c9afe145b57b 33 lcd.FillCircle(80, 80, 50);
Oshyrath 0:c9afe145b57b 34 wait(0.1);
Oshyrath 0:c9afe145b57b 35 lcd.SetTextColor(LCD_COLOR_YELLOW);
Oshyrath 0:c9afe145b57b 36 lcd.FillEllipse(150, 150, 50, 100);
Oshyrath 0:c9afe145b57b 37 wait(0.1);
Oshyrath 0:c9afe145b57b 38 lcd.SetTextColor(LCD_COLOR_RED);
Oshyrath 0:c9afe145b57b 39 lcd.FillCircle(200, 200, 40);
Oshyrath 0:c9afe145b57b 40 wait(1);
Oshyrath 0:c9afe145b57b 41
Oshyrath 0:c9afe145b57b 42 lcd.SetBackColor(LCD_COLOR_ORANGE);
Oshyrath 0:c9afe145b57b 43 lcd.SetTextColor(LCD_COLOR_CYAN);
Oshyrath 0:c9afe145b57b 44 BSP_LCD_SetFont(&Font24);
Oshyrath 0:c9afe145b57b 45 lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"HAVE FUN !!!", CENTER_MODE);
Oshyrath 0:c9afe145b57b 46 wait(1);
Oshyrath 0:c9afe145b57b 47
Oshyrath 0:c9afe145b57b 48 led1 = !led1;
Oshyrath 0:c9afe145b57b 49 wait(0.5);
Oshyrath 0:c9afe145b57b 50 }
Oshyrath 0:c9afe145b57b 51 }
Oshyrath 0:c9afe145b57b 52