Add virtual touch buttons for Monopoly game and centralize configuration in ModalButtonHelper

This commit is contained in:
Adolfo Reyna
2026-02-06 22:11:24 -05:00
parent eb86c3fc0e
commit e2817262b0
11 changed files with 194 additions and 8 deletions

View File

@@ -48,6 +48,32 @@ public:
* @return InputEvent (valid=false if no valid input)
*/
InputEvent process_button_input();
/**
* @brief Get virtual button regions for drawing
* @param a_rect Pointer to rectangle for Button A [x, y, w, h]
* @param b_rect Pointer to rectangle for Button B [x, y, w, h]
*/
void get_virtual_button_regions(int* a_rect, int* b_rect) const;
/**
* @brief Set virtual button regions
*/
void set_virtual_button_regions(int ax, int ay, int aw, int ah, int bx, int by, int bw, int bh);
/**
* @brief Clear virtual button regions (disables detection)
*/
void clear_virtual_button_regions();
/**
* @brief Check if a touch event hits a virtual button
* @param x Touch X coordinate
* @param y Touch Y coordinate
* @param out_type Output parameter for the button type if hit
* @return true if a virtual button was hit
*/
bool check_virtual_buttons(int16_t x, int16_t y, InputType& out_type) const;
/**
* @brief Get human-readable gesture name
@@ -71,6 +97,11 @@ public:
private:
LowLevelTouch* touch;
const GameConfig* config;
// Virtual button regions
int v_button_a[4] = {0, 0, 0, 0}; // [x, y, w, h]
int v_button_b[4] = {0, 0, 0, 0};
bool v_buttons_active = false;
};
#endif // INPUT_MANAGER_H