input manager provides ground of truth on device input choise

This commit is contained in:
Adolfo Reyna
2026-01-30 22:07:31 -05:00
parent 436245a7a2
commit f860d4f5e6
10 changed files with 97 additions and 44 deletions

View File

@@ -4,14 +4,14 @@
// Simple demo game to test the launcher
#include "demo_game.h"
#include "board_config.h"
#include "input_manager.h"
#include <stdio.h>
#include <string.h>
extern Font font_5x5_obj;
DemoGame::DemoGame(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui)
: Game(width, height, renderer, gui), tap_count(0), exit_requested(false) {
DemoGame::DemoGame(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager)
: Game(width, height, renderer, gui, input_manager), tap_count(0), exit_requested(false) {
}
void DemoGame::init() {
@@ -54,11 +54,11 @@ void DemoGame::draw() {
// Instructions
if (tap_count < 3) {
#ifdef BUTTON_KEY0_PIN
renderer->draw_string(width/2 - 80, y + 80, "Tap or press 3 times", true);
#else
renderer->draw_string(width/2 - 80, y + 80, "Tap 3 times to exit", true);
#endif
if (input_manager->has_buttons()) {
renderer->draw_string(width/2 - 80, y + 80, "Tap or press 3 times", true);
} else {
renderer->draw_string(width/2 - 80, y + 80, "Tap 3 times to exit", true);
}
} else {
renderer->draw_string(width/2 - 70, y + 80, "Exiting to menu...", true);
}