From bdd8d563ff3f0eec41cc45d07f6c00622a531a72 Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Tue, 21 May 2024 22:51:55 -0600 Subject: first commit --- jsi/src/jsi.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 jsi/src/jsi.h (limited to 'jsi/src/jsi.h') diff --git a/jsi/src/jsi.h b/jsi/src/jsi.h new file mode 100644 index 0000000..718b4dc --- /dev/null +++ b/jsi/src/jsi.h @@ -0,0 +1,74 @@ +/* + * jsi (Joystick interface) c libray +*/ + +#ifdef _WIN32 + +#include + +#else + +// Linux header. +#include +#include +#include + +// Unix headers. +#include +#include + +#endif + +// OS headers. +#include +#include +#include + +// C. +#include +#include +#include +#include +#include + +#ifndef JSI_H +#define JSI_H + +#define JSI_VERSION "Still in making" + +#define JSI_TRUE 1 +#define JSI_FALSE 0 +#define JSI_NAME_MAX 128 + +#define JSI_UP 0x0 +#define JSI_DOWN 0x1 + +#define JSI_TYPE_BUTTON 0x1 +#define JSI_TYPE_AXIS 0x2 +#define JSI_TYPE_INIT 0x80 + +struct jsi_joy_layout { + int axes; + int buttons; + char name[JSI_NAME_MAX]; +}; + +typedef struct { + int fd; + int num; + int joystick_count_init; + struct jsi_joy_layout layout; +} jsi_joystick; + +struct jsi_event { + int value; + int type; + int num; +}; + +int jsi_get_joystick(int joy_num, jsi_joystick * joystick_data); +void jsi_close_joystick(jsi_joystick joystick_data); +int jsi_joy_count(); +int jsi_get_event(jsi_joystick joystick_data, struct jsi_event * event_data); + +#endif // JSI_H -- cgit v1.2.3