Integrate thematic sprites and improve Monopoly UI
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "community_chest.h"
|
||||
#include "player.h"
|
||||
#include "MonopolyBoardRenderer.h"
|
||||
#include "sprites.h"
|
||||
|
||||
class CommunityChestModalGame : public Game {
|
||||
const CommunityCard* card;
|
||||
@@ -37,26 +38,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 - 15 * 6) / 2, win_y + 8, "COMMUNITY CHEST", 1);
|
||||
renderer->draw_string_scaled(ix + (iw - 15 * 12) / 2, iy + 10, "COMMUNITY CHEST", 2);
|
||||
renderer->set_text_color(true);
|
||||
|
||||
// Card Description
|
||||
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;
|
||||
@@ -75,14 +75,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++;
|
||||
}
|
||||
|
||||
// Draw Community Chest sprite
|
||||
renderer->draw_bitmap(epd_bitmap_CommunityChest, 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; }
|
||||
|
||||
Reference in New Issue
Block a user