Go to the documentation of this file.
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",
183 #ifdef __EMSCRIPTEN__
185 emscripten_cancel_main_loop();
224 SDL_Log(
"Joystick has %d axes, %d hats, %d balls, and %d buttons\n",
229 #ifdef __EMSCRIPTEN__
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) {
379 main(
int argc,
char *argv[])
@ SDL_JOYSTICK_TYPE_GAMECONTROLLER
#define SDL_RenderPresent
int main(int argc, char *argv[])
#define SDL_JoystickGetVendor
#define SDL_WINDOWPOS_CENTERED
#define SDL_JoystickClose
@ SDL_LOG_CATEGORY_APPLICATION
#define SDL_JoystickGetButton
#define SDL_INIT_JOYSTICK
#define SDL_JoystickGetGUID
GLdouble GLdouble GLdouble r
#define SDL_RenderFillRect
#define SDL_QuitSubSystem
static SDL_bool WatchJoystick(SDL_Joystick *joystick)
#define SDL_JoystickGetGUIDString
#define SDL_JoystickInstanceID
#define SDL_JoystickNameForIndex
@ SDL_JOYSTICK_TYPE_GUITAR
#define SDL_JoystickGetHat
#define SDL_JoystickGetProduct
GLfloat GLfloat GLfloat GLfloat h
#define SDL_JoystickNumButtons
@ SDL_JOYSTICK_TYPE_DANCE_PAD
The type used to identify a window.
@ SDL_JOYSTICK_TYPE_DRUM_KIT
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK
A variable controlling whether the Android / iOS built-in accelerometer should be listed as a joystic...
#define SDL_JoystickNumAxes
#define SDL_JoystickGetType
GLint GLint GLint GLint GLint x
EGLSurface EGLNativeWindowType * window
#define SDL_JoystickFromInstanceID
@ SDL_JOYSTICK_TYPE_FLIGHT_STICK
GLuint const GLchar * name
#define SDL_JoystickGetAttached
@ SDL_JOYSTICK_TYPE_THROTTLE
#define SDL_assert(condition)
GLint GLint GLint GLint GLint GLint y
#define SDL_JoystickRumble
#define SDL_JoystickNumHats
#define SDL_LogSetPriority
#define SDL_JoystickGetAxis
A rectangle, with the origin at the upper left.
@ SDL_JOYSTICK_TYPE_ARCADE_PAD
#define SDL_SetRenderDrawColor
static void DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h)
#define SDL_JoystickNumBalls
#define SDL_CreateRenderer
#define SDL_DestroyRenderer
static SDL_AudioDeviceID device
@ SDL_JOYSTICK_TYPE_WHEEL
GLuint GLuint GLsizei GLenum type
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)
#define SDL_DestroyWindow
GLubyte GLubyte GLubyte GLubyte w
@ SDL_JOYSTICK_TYPE_ARCADE_STICK