Initial publish
Dependencies: mbed
Fork of el17dg by
Diff: main/main.cpp
- Revision:
- 30:d454d0cb72bc
- Parent:
- 29:579e00b7f118
- Child:
- 31:becb8f6bf7b7
--- a/main/main.cpp Mon Apr 15 12:59:51 2019 +0000 +++ b/main/main.cpp Tue Apr 16 21:16:33 2019 +0000 @@ -16,6 +16,7 @@ #include "models.h" #include "tutorial.h" #include "gameobject.h" +#include "settings.h" N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); @@ -28,6 +29,7 @@ Menu menu; Game game; Tutorial tutorial; +Settings settings; Gamepad gamepad; GameObject lineOne; @@ -45,9 +47,12 @@ void pointer_position(int menu_number); void ship_movement(); void menuSelection(); +//void introMusic(); ScreenOption current_screen = ScreenOption_Menu; +//int low_frequency_music_counter = 0; + void intro(); int main(){ @@ -112,6 +117,7 @@ if (lineTwoShips.pos.x < 0){ lineTwoShips.pos.x += 1; } introPartOneText(); + //introMusic(); lcd.refresh(); wait(0.01); @@ -152,11 +158,32 @@ if (back_to_menu) { current_screen = ScreenOption_Menu; } - } + } + if (current_screen == ScreenOption_Settings) { + bool back_to_menu = settings.updateAndWriteSettings(); + + if (back_to_menu) { + current_screen = ScreenOption_Menu; + } + } else if (current_screen == ScreenOption_Menu) { bool wantsToChangeScreen = menu.updateAndDraw(); if (wantsToChangeScreen) { current_screen = menu.getCurrentScreenSelection(); } } -} \ No newline at end of file +} + +/*void introMusic(){ + if (low_frequency_music_counter == 0){ gamepad.tone(90,1);} + else if (low_frequency_music_counter == 1){gamepad.tone(60,1);} + else if (low_frequency_music_counter == 2){gamepad.tone(90,1);} + else if (low_frequency_music_counter == 3){gamepad.tone(60,1);} + else if (low_frequency_music_counter == 4){gamepad.tone(90,1);} + else if (low_frequency_music_counter == 5){gamepad.tone(60,1);} + else if (low_frequency_music_counter== 6){ + gamepad.tone(90,1); + low_frequency_music_counter = 0; + } + low_frequency_music_counter++; +}*/ \ No newline at end of file