Fix emulator compilation and crash, and implement Monopoly payment modal
This commit is contained in:
@@ -11,23 +11,32 @@ public:
|
||||
static void set_monopoly_regions(InputManager* input_manager, uint16_t width, uint16_t height) {
|
||||
if (!input_manager) return;
|
||||
|
||||
// --- BUTTON CONFIGURATION ---
|
||||
// Adjust these variables to move the virtual buttons easily
|
||||
int btn_w = 60;
|
||||
int btn_h = 60;
|
||||
int margin_right = 135; // Positioned for the inner board area (W - 135 = 345)
|
||||
int start_y = 80; // Vertical start position
|
||||
int spacing = 30; // Gap between buttons
|
||||
|
||||
int btn_x = width - margin_right;
|
||||
int btn_a_y = start_y;
|
||||
int btn_b_y = btn_a_y + btn_h + spacing;
|
||||
if (width < 480) {
|
||||
// Sidebar mode for 480x320 screen (Buttons at 400-480)
|
||||
int sidebar_x = width;
|
||||
int sidebar_w = 480 - width;
|
||||
int btn_h = height / 2;
|
||||
input_manager->set_virtual_button_regions(
|
||||
sidebar_x, 0, sidebar_w, btn_h, // Button A (Top half)
|
||||
sidebar_x, btn_h, sidebar_w, btn_h // Button B (Bottom half)
|
||||
);
|
||||
} else {
|
||||
// Inner dashboard mode (fallback)
|
||||
int btn_w = 60;
|
||||
int btn_h = 60;
|
||||
int margin_right = 135; // Positioned for the inner board area (W - 135 = 345)
|
||||
int start_y = 80; // Vertical start position
|
||||
int spacing = 30; // Gap between buttons
|
||||
|
||||
int btn_x = width - margin_right;
|
||||
int btn_a_y = start_y;
|
||||
int btn_b_y = btn_a_y + btn_h + spacing;
|
||||
|
||||
// Apply regions to input manager
|
||||
input_manager->set_virtual_button_regions(
|
||||
btn_x, btn_a_y, btn_w, btn_h, // Button A (Top)
|
||||
btn_x, btn_b_y, btn_w, btn_h // Button B (Bottom)
|
||||
);
|
||||
input_manager->set_virtual_button_regions(
|
||||
btn_x, btn_a_y, btn_w, btn_h,
|
||||
btn_x, btn_b_y, btn_w, btn_h
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,17 +51,20 @@ public:
|
||||
// Save current color
|
||||
bool original_color = renderer->get_current_text_color();
|
||||
|
||||
// Draw Button A (Top)
|
||||
// Draw Button A
|
||||
renderer->draw_filled_rectangle(a[0], a[1], a[2], a[3], false, 0); // White back
|
||||
renderer->draw_rectangle(a[0], a[1], a[2], a[3], true, 2); // Black border
|
||||
renderer->set_text_color(true);
|
||||
renderer->draw_string_scaled(a[0] + (a[2] - 12) / 2, a[1] + (a[3] - 16) / 2, "A", 2);
|
||||
// Use larger font scaling if buttons are big (sidebar mode)
|
||||
int scale_a = (a[3] > 100) ? 4 : 2;
|
||||
renderer->draw_string_scaled(a[0] + (a[2] - 6 * scale_a) / 2, a[1] + (a[3] - 8 * scale_a) / 2, "A", scale_a);
|
||||
|
||||
// Draw Button B (Under A)
|
||||
// Draw Button B
|
||||
renderer->draw_filled_rectangle(b[0], b[1], b[2], b[3], false, 0); // White back
|
||||
renderer->draw_rectangle(b[0], b[1], b[2], b[3], true, 2); // Black border
|
||||
renderer->set_text_color(true);
|
||||
renderer->draw_string_scaled(b[0] + (b[2] - 12) / 2, b[1] + (b[3] - 16) / 2, "B", 2);
|
||||
int scale_b = (b[3] > 100) ? 4 : 2;
|
||||
renderer->draw_string_scaled(b[0] + (b[2] - 6 * scale_b) / 2, b[1] + (b[3] - 8 * scale_b) / 2, "B", scale_b);
|
||||
|
||||
// Restore color
|
||||
renderer->set_text_color(original_color);
|
||||
|
||||
Reference in New Issue
Block a user