Add virtual touch buttons for Monopoly game and centralize configuration in ModalButtonHelper

This commit is contained in:
Adolfo Reyna
2026-02-06 22:11:24 -05:00
parent eb86c3fc0e
commit e2817262b0
11 changed files with 194 additions and 8 deletions

View File

@@ -5,6 +5,7 @@
#include "../../display/low_level_gui.h"
#include "input_manager.h"
#include "player.h"
#include "ModalButtonHelper.h"
#include <string.h>
#include <stdio.h>
@@ -16,7 +17,10 @@ public:
TurnModalGame(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager, Player* next)
: Game(width, height, renderer, gui, input_manager), next_player(next), dismissed(false) {}
void init() override { dismissed = false; }
void init() override {
dismissed = false;
ModalButtonHelper::set_monopoly_regions(input_manager, width, height);
}
Type get_type() const override { return Type::MONOPOLY_TURN; }
bool update(const InputEvent& event) override {
@@ -61,6 +65,8 @@ public:
// Prompt
const char* prompt = "Press B to start";
renderer->draw_string_scaled(ix + (iw - (int)strlen(prompt) * 6) / 2, iy + ih - 30, prompt, 1);
ModalButtonHelper::draw_virtual_buttons(renderer, input_manager);
}
bool is_dismissed() const { return dismissed; }