- [NEW] Soport per a joystick tipo Sinclair

This commit is contained in:
2025-08-15 22:58:53 +02:00
parent 0530c255c1
commit 864c6b929d
3 changed files with 182 additions and 0 deletions
+10
View File
@@ -21,6 +21,7 @@
#include "ay-3-8912.h"
#include "ay_viewer.h"
#include "file.h"
#include "gamepad.h"
uint32_t time = 0;
uint32_t t_states = 0;
@@ -173,11 +174,20 @@ int main(int argc, char *argv[])
if (e.type == SDL_QUIT) { zx_system::shutdown(); break; }
if (e.type == SDL_JOYDEVICEADDED) {
gamepad::add(e.jdevice.which, GAMEPAD_TYPE_ANY);
printf("JOYSTICK CONECTAT: %i\n", e.jdevice.which);
// [TODO] Mostrar dialeg de triar tipus de joystick
}
if (e.type == SDL_JOYDEVICEREMOVED) {
gamepad::remove(e.jdevice.which);
printf("JOYSTICK DESCONECTAT: %i\n", e.jdevice.which);
}
if (e.type == SDL_CONTROLLERBUTTONDOWN) {
gamepad::buttonDown(e.jbutton.which, e.jbutton.button);
}
if (e.type == SDL_CONTROLLERBUTTONUP) {
gamepad::buttonUp(e.jbutton.which, e.jbutton.button);
}
if (e.type == SDL_MOUSEBUTTONDOWN) result = ui::window::sendEvent(e.button.windowID, &e);
if (e.type == SDL_MOUSEBUTTONUP) result = ui::window::sendEvent(e.button.windowID, &e);
if (e.type == SDL_MOUSEMOTION) result = ui::window::sendEvent(e.motion.windowID, &e);