diff options
author | nathansmith117 <nathansmith117@sdf.org> | 2024-05-22 04:51:55 +0000 |
---|---|---|
committer | nathansmith117 <nathansmith117@sdf.org> | 2024-05-22 04:51:55 +0000 |
commit | bdd8d563ff3f0eec41cc45d07f6c00622a531a72 (patch) | |
tree | ceb9cac325b893b20b5d0303e988252136680e03 /jsi/src/jsi_win.c | |
download | forgorttonProjects-main.tar.gz forgorttonProjects-main.tar.bz2 forgorttonProjects-main.zip |
Diffstat (limited to 'jsi/src/jsi_win.c')
-rw-r--r-- | jsi/src/jsi_win.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/jsi/src/jsi_win.c b/jsi/src/jsi_win.c new file mode 100644 index 0000000..17d91b5 --- /dev/null +++ b/jsi/src/jsi_win.c @@ -0,0 +1,44 @@ +/* + * jsi (Joystick interface) c libray +*/ + +#include "jsi.h" + +int jsi_get_joystick(int joy_num, jsi_joystick * joystick_data) { + DWORD dw_result; + + switch (joy_num) { + case 1: + dw_result = joySetCapture(GetDesktopWindow(), JOYSTICKID1, 0, FALSE); + break; + case 2: + dw_result = joySetCapture(GetDesktopWindow(), JOYSTICKID2, 0, FALSE); + break; + default: + return -1; + } + + // Check for errors. + switch (dw_result) { + case JOYERR_UNPLUGGED: + return -1; + case MMSYSERR_NODRIVER: + return -1; + case JOYERR_NOCANDO: + return -1; + default: + break; + } + + return 0; +} + +void jsi_close_joystick(jsi_joystick joystick_data) {} + +int jsi_joy_count() { + return (int)joyGetNumDevs(); +} + +int jsi_get_event(jsi_joystick joystick_data, struct jsi_event * event_data) { + return -1; +} |