73 lines
1.8 KiB
C++
73 lines
1.8 KiB
C++
//======================================================
|
|
// MAIN PROGRAM LOOP
|
|
//======================================================
|
|
|
|
/* game selector is the main function that tell the game groutine
|
|
* which game to be JSONed and at what parameters
|
|
*/
|
|
|
|
void bluetooth_game_selector(String game, String settings)
|
|
{
|
|
// Kick Counter Game
|
|
if(game == "ct") {
|
|
terminal(GM_COUNTER);
|
|
game_counter_bluetooth(settings);
|
|
return;
|
|
}
|
|
|
|
// Time Attack Game
|
|
else if(game == "ta") {
|
|
terminal(GM_TATTACK);
|
|
time_attack_bluetooth(settings);
|
|
return;
|
|
}
|
|
|
|
// Time Attack Game
|
|
else if(game == "ra") {
|
|
terminal(GM_REACTION);
|
|
game_reaction_bluetooth(settings);
|
|
return;
|
|
}
|
|
|
|
// Unknown Game
|
|
else {
|
|
dualcomm(UNKNOWN_GAME);
|
|
return;
|
|
}
|
|
}
|
|
//======================================================
|
|
// GAME SELECTOR CODE
|
|
//======================================================
|
|
// SELECTOR ROUTINE
|
|
//------------------------------------------------------
|
|
void standalone_game_selector()
|
|
{
|
|
// Check Bluetooth
|
|
if(isBluetooth)
|
|
{
|
|
// Reading The Message From Bluetooth
|
|
String message = Bluetooth.readStringUntil('\n');
|
|
// Cleaning Bluetooth Receive Buffer
|
|
flushBluetooth;
|
|
// Cleaning The Message
|
|
message.trim();
|
|
// Cleaning JSON Document
|
|
JSON.clear();
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------
|
|
// DISPLAY MENU TITLE FUNCTION
|
|
//------------------------------------------------------
|
|
|
|
void GAME_TITLE_DISPLAY(uint8_t Number, String Title)
|
|
{
|
|
// Starting The First Code
|
|
OLED_CLEAR();
|
|
drawTextCenter(128/2, 5, 1, "MODE " + String(Number + 1));
|
|
drawTextCenter(128/2, 22, 2, " - " + Title + " - ");
|
|
drawTextCenter(128/2, 43, 1, "<< SELECT >>");
|
|
OLED_SHOW();
|
|
DISPLAY_CHANGED = true;
|
|
}
|