Integrate thematic sprites and improve Monopoly UI

This commit is contained in:
Adolfo Reyna
2026-02-02 23:14:14 -05:00
parent 3bdbfb1811
commit eb86c3fc0e
8 changed files with 722 additions and 79 deletions

View File

@@ -8,6 +8,7 @@
#include "player.h"
#include "MonopolyBoardRenderer.h"
#include "sprites.h"
class ChanceModalGame : public Game {
const ChanceCard* card;
@@ -38,26 +39,25 @@ public:
MonopolyBoardRenderer::draw_board_perimeter(renderer, width, height, players, players_count, player_pos);
}
int win_w = 180;
int win_h = 120;
int win_x = (width - win_w) / 2;
int win_y = (height - win_h) / 2;
char buf[256];
// --- Inner UI (Center Area) ---
int cw = width / 7;
int ch = height / 7;
int ix = cw + 2, iy = ch + 2;
int iw = width - 2 * cw - 4, ih = height - 2 * ch - 4;
// Window background
renderer->draw_filled_rectangle(win_x, win_y, win_w, win_h, false, 0);
renderer->draw_rectangle(win_x, win_y, win_w, win_h, true, 2);
renderer->draw_rectangle(win_x + 3, win_y + 3, win_w - 6, win_h - 6, true, 1);
renderer->draw_filled_rectangle(ix, iy, iw, ih, false, 0);
renderer->draw_rectangle(ix, iy, iw, ih, true, 1);
// Header
renderer->draw_filled_rectangle(win_x + 4, win_y + 4, win_w - 8, 25, true, 1);
renderer->draw_filled_rectangle(ix + 2, iy + 2, iw - 4, 30, true, 1);
renderer->set_text_color(false);
renderer->draw_string_scaled(win_x + (win_w - 6 * 6) / 2, win_y + 8, "CHANCE", 1);
renderer->draw_string_scaled(ix + (iw - 6 * 12) / 2, iy + 10, "CHANCE", 2);
renderer->set_text_color(true);
// Card Description (with simple word wrap)
int text_y = win_y + 40;
int max_chars_per_line = (win_w - 20) / 6;
int text_y = iy + 45;
int max_chars_per_line = (iw - 10) / 12;
const char* text = card->description;
char line[64];
int start = 0;
@@ -78,14 +78,17 @@ public:
int copy_len = (count < 63) ? count : 63;
strncpy(line, text + start, copy_len);
line[copy_len] = '\0';
renderer->draw_string_scaled(win_x + 10, text_y, line, 1);
text_y += 10;
renderer->draw_string_scaled(ix + (iw - copy_len * 12) / 2, text_y, line, 2);
text_y += 18;
start += count;
if (text[start] == ' ') start++; // Skip the space
}
// Draw Chance sprite
renderer->draw_bitmap(epd_bitmap_Chance, ix + iw - 105, iy + ih - 105, 100, 100, true);
// Prompt
renderer->draw_string_scaled(win_x + (win_w - 12 * 6) / 2, win_y + win_h - 15, "Press ANY Button", 1);
renderer->draw_string_scaled(ix + (iw - 12 * 12) / 2, iy + ih - 20, "Press BUTTON", 2);
}
bool is_dismissed() const { return dismissed; }