Fix emulator compilation and crash, and implement Monopoly payment modal
This commit is contained in:
@@ -1,6 +1,56 @@
|
||||
#pragma once
|
||||
#ifndef INPUT_MANAGER_H
|
||||
#define INPUT_MANAGER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "input_event.h"
|
||||
|
||||
// Minimal stub for emulator build
|
||||
class InputManager {
|
||||
public:
|
||||
bool has_buttons() const { return false; }
|
||||
bool has_touch() const { return false; }
|
||||
|
||||
void get_virtual_button_regions(int* a_rect, int* b_rect) const {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
a_rect[i] = v_button_a[i];
|
||||
b_rect[i] = v_button_b[i];
|
||||
}
|
||||
}
|
||||
void set_virtual_button_regions(int ax, int ay, int aw, int ah, int bx, int by, int bw, int bh) {
|
||||
v_button_a[0] = ax; v_button_a[1] = ay; v_button_a[2] = aw; v_button_a[3] = ah;
|
||||
v_button_b[0] = bx; v_button_b[1] = by; v_button_b[2] = bw; v_button_b[3] = bh;
|
||||
v_buttons_active = true;
|
||||
}
|
||||
void clear_virtual_button_regions() {
|
||||
v_buttons_active = false;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
v_button_a[i] = 0;
|
||||
v_button_b[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool check_virtual_buttons(int16_t x, int16_t y, InputType& out_type) const {
|
||||
if (!v_buttons_active) return false;
|
||||
|
||||
if (x >= v_button_a[0] && x <= v_button_a[0] + v_button_a[2] &&
|
||||
y >= v_button_a[1] && y <= v_button_a[1] + v_button_a[3]) {
|
||||
out_type = INPUT_BUTTON_0;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (x >= v_button_b[0] && x <= v_button_b[0] + v_button_b[2] &&
|
||||
y >= v_button_b[1] && y <= v_button_b[1] + v_button_b[3]) {
|
||||
out_type = INPUT_BUTTON_1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
int v_button_a[4] = {0, 0, 0, 0};
|
||||
int v_button_b[4] = {0, 0, 0, 0};
|
||||
bool v_buttons_active = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user