interpreting monopoly as multi scree game

This commit is contained in:
Adolfo Reyna
2026-01-31 19:05:58 -05:00
parent 2165186b6b
commit 561f7c5951
7 changed files with 138 additions and 221 deletions

View File

@@ -0,0 +1,32 @@
// DiceModalGame.h
#pragma once
#include "../../lib/game.h"
#include "../../display/low_level_render.h"
#include "../../display/low_level_gui.h"
#include "input_manager.h"
class DiceModalGame : public Game {
int dice1, dice2;
bool dismissed;
public:
DiceModalGame(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager, int d1, int d2)
: Game(width, height, renderer, gui, input_manager), dice1(d1), dice2(d2), dismissed(false) {}
void init() override { dismissed = false; }
bool update(const InputEvent& event) override {
if (event.type == INPUT_BUTTON_0 || event.type == INPUT_BUTTON_1) {
dismissed = true;
return true;
}
return false;
}
void draw() override {
int win_w = 220, win_h = 120;
int win_x = (width - win_w) / 2, win_y = (height - win_h) / 2;
char buf[64];
gui->draw_new_window(win_x, win_y, win_w, win_h, "Dice Roll");
snprintf(buf, sizeof(buf), "You rolled: %d + %d", dice1, dice2);
renderer->draw_string_scaled(win_x + 30, win_y + 40, buf, 2);
renderer->draw_string_scaled(10, height - 20, "Press any button...", 2);
}
bool is_dismissed() const { return dismissed; }
};