Add virtual touch buttons for Monopoly game and centralize configuration in ModalButtonHelper
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "../../display/low_level_gui.h"
|
||||
#include "input_manager.h"
|
||||
#include "MonopolyBoardRenderer.h"
|
||||
#include "ModalButtonHelper.h"
|
||||
|
||||
class DiceModalGame : public Game {
|
||||
int dice1, dice2;
|
||||
@@ -49,7 +50,10 @@ class DiceModalGame : public Game {
|
||||
public:
|
||||
DiceModalGame(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager, int d1, int d2, const BoardTile* from, const BoardTile* to, Player* p, int count)
|
||||
: Game(width, height, renderer, gui, input_manager), dice1(d1), dice2(d2), from_tile(from), to_tile(to), players(p), players_count(count), 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_DICE; }
|
||||
bool update(const InputEvent& event) override {
|
||||
// Only B dismisses now, so A can still be used for "change action" (even if it does nothing here)
|
||||
@@ -114,6 +118,8 @@ public:
|
||||
renderer->set_text_color(false);
|
||||
renderer->draw_string_scaled(btn_x + 5, btn_y + 5, "> CONTINUE", 2);
|
||||
renderer->set_text_color(true);
|
||||
|
||||
ModalButtonHelper::draw_virtual_buttons(renderer, input_manager);
|
||||
}
|
||||
bool is_dismissed() const { return dismissed; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user