Files
basic1/emulator/input_manager.h
Adolfo Reyna 285dffc32e Add Lua scripting support to desktop emulator
- Created emulator-specific lua_game_emulator.cpp using filesystem instead of FatFS
- Created lua_game_loader_emulator.cpp to scan games/lua_examples directory
- Updated CMakeLists.txt to include Lua 5.4 engine and bindings
- Updated to SFML 3.0 API compatibility (event handling, sprite initialization)
- Updated Game class to use public members for Lua bindings
- Updated GameLauncher to use std::function for lambda captures
- Added continuous 60 FPS rendering for smooth display
- Emulator now loads and runs all three example Lua games
2026-02-07 12:14:33 -05:00

57 lines
1.7 KiB
C++

#ifndef INPUT_MANAGER_H
#define INPUT_MANAGER_H
#include <stdint.h>
#include "input_event.h"
// Minimal stub for emulator build
class InputManager {
public:
inline bool has_buttons() const { return false; }
inline bool has_touch() const { return false; }
inline 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];
}
}
inline 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;
}
inline 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;
}
}
inline 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