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

@@ -9,6 +9,7 @@
#include "MonopolyBoardRenderer.h"
#include "sprites.h"
#include "ModalButtonHelper.h"
class ChanceModalGame : public Game {
const ChanceCard* card;
@@ -21,7 +22,10 @@ public:
ChanceModalGame(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager, const ChanceCard* c, Player* p_list = nullptr, int p_count = 0, int p_pos = -1)
: Game(width, height, renderer, gui, input_manager), card(c), dismissed(false), players(p_list), players_count(p_count), player_pos(p_pos) {}
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_CHANCE; }
bool update(const InputEvent& event) override {
@@ -89,6 +93,8 @@ public:
// Prompt
renderer->draw_string_scaled(ix + (iw - 12 * 12) / 2, iy + ih - 20, "Press BUTTON", 2);
ModalButtonHelper::draw_virtual_buttons(renderer, input_manager);
}
bool is_dismissed() const { return dismissed; }