22 #include <emscripten/emscripten.h>
25 #ifndef SDL_JOYSTICK_DISABLED
28 #define SCREEN_WIDTH 320
29 #define SCREEN_HEIGHT 480
31 #define SCREEN_WIDTH 640
32 #define SCREEN_HEIGHT 480
50 type =
"Game Controller";
56 type =
"Arcade Stick";
59 type =
"Flight Stick";
110 switch (
event.type) {
113 SDL_Log(
"Joystick device %d added.\n", (
int)
event.jdevice.which);
125 SDL_Log(
"Joystick device %d removed.\n", (
int)
event.jdevice.which);
133 SDL_Log(
"Joystick %d axis %d value: %d\n",
138 SDL_Log(
"Joystick %d hat %d value:",
153 SDL_Log(
"Joystick %d ball %d delta: (%d,%d)\n",
158 SDL_Log(
"Joystick %d button %d down\n",
161 if (
event.jbutton.button == 0) {
166 SDL_Log(
"Joystick %d button %d up\n",
173 SDL_Log(
"Lagging for 3 seconds...\n");
257 #ifdef __EMSCRIPTEN__
259 emscripten_cancel_main_loop();
299 #ifdef __EMSCRIPTEN__
300 emscripten_set_main_loop_arg(
loop,
NULL, 0, 1);
318 main(
int argc,
char *argv[])
#define SDL_INIT_JOYSTICK
#define SDL_assert(condition)
#define SDL_RenderPresent
#define SDL_DestroyWindow
#define SDL_JoystickNumAxes
#define SDL_RenderFillRect
#define SDL_DestroyRenderer
#define SDL_SetRenderDrawColor
#define SDL_JoystickGetGUID
#define SDL_JoystickNumHats
#define SDL_JoystickGetAxis
#define SDL_JoystickClose
#define SDL_JoystickRumble
#define SDL_JoystickGetHat
#define SDL_JoystickGetGUIDString
#define SDL_JoystickGetType
#define SDL_CreateRenderer
#define SDL_JoystickNumButtons
#define SDL_LogSetPriority
#define SDL_JoystickFromInstanceID
#define SDL_JoystickGetVendor
#define SDL_JoystickGetButton
#define SDL_JoystickNumBalls
#define SDL_JoystickInstanceID
#define SDL_QuitSubSystem
#define SDL_JoystickGetProduct
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK
A variable controlling whether the Android / iOS built-in accelerometer should be listed as a joystic...
@ SDL_JOYSTICK_TYPE_DANCE_PAD
@ SDL_JOYSTICK_TYPE_ARCADE_PAD
@ SDL_JOYSTICK_TYPE_ARCADE_STICK
@ SDL_JOYSTICK_TYPE_WHEEL
@ SDL_JOYSTICK_TYPE_THROTTLE
@ SDL_JOYSTICK_TYPE_GUITAR
@ SDL_JOYSTICK_TYPE_FLIGHT_STICK
@ SDL_JOYSTICK_TYPE_GAMECONTROLLER
@ SDL_JOYSTICK_TYPE_DRUM_KIT
@ SDL_LOG_CATEGORY_APPLICATION
GLint GLint GLint GLint GLint GLint y
GLdouble GLdouble GLdouble r
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w
#define SDL_WINDOWPOS_CENTERED
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
EGLSurface EGLNativeWindowType * window
A rectangle, with the origin at the upper left (integer).
The type used to identify a window.
int main(int argc, char *argv[])
static void PrintJoystick(SDL_Joystick *joystick)
static SDL_Renderer * screen
static SDL_Joystick * joystick
static void DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h)
typedef int(__stdcall *FARPROC)()