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
51 SDL_Joystick *joystick = (SDL_Joystick *)arg;
61 SDL_Log(
"Joystick device %d removed.\n", (
int)
event.jdevice.which);
66 SDL_Log(
"Joystick %d axis %d value: %d\n",
71 SDL_Log(
"Joystick %d hat %d value:",
86 SDL_Log(
"Joystick %d ball %d delta: (%d,%d)\n",
91 SDL_Log(
"Joystick %d button %d down\n",
94 if (
event.jbutton.button == 0) {
99 SDL_Log(
"Joystick %d button %d up\n",
185 emscripten_cancel_main_loop();
224 SDL_Log(
"Joystick has %d axes, %d hats, %d balls, and %d buttons\n",
230 emscripten_set_main_loop_arg(
loop, joystick, 0, 1);
248 SDL_Joystick *joystick;
267 if (joystick ==
NULL) {
274 guid,
sizeof (guid));
277 type =
"Game Controller";
283 type =
"Arcade Stick";
286 type =
"Flight Stick";
319#if defined(__ANDROID__) || defined(__IPHONEOS__)
328#if defined(__ANDROID__) || defined(__IPHONEOS__)
334 if (joystick !=
NULL) {
338 while ( keepGoing ) {
339 if (joystick ==
NULL) {
340 if ( !reportederror ) {
353 SDL_Log(
"Waiting for attach\n");
361 device =
event.jdevice.which;
363 if (joystick !=
NULL) {
379main(
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_JoystickNameForIndex
#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_JoystickGetAttached
#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
GLuint const GLchar * name
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
static SDL_AudioDeviceID device
A rectangle, with the origin at the upper left (integer).
The type used to identify a window.
int main(int argc, char *argv[])
static SDL_bool WatchJoystick(SDL_Joystick *joystick)
static void DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h)