SDL  2.0
testgamecontroller.c
Go to the documentation of this file.
1 /*
2  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
3 
4  This software is provided 'as-is', without any express or implied
5  warranty. In no event will the authors be held liable for any damages
6  arising from the use of this software.
7 
8  Permission is granted to anyone to use this software for any purpose,
9  including commercial applications, and to alter it and redistribute it
10  freely.
11 */
12 
13 /* Simple program to test the SDL game controller routines */
14 
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 
19 #include "SDL.h"
20 
21 #ifdef __EMSCRIPTEN__
22 #include <emscripten/emscripten.h>
23 #endif
24 
25 #ifndef SDL_JOYSTICK_DISABLED
26 
27 #ifdef __IPHONEOS__
28 #define SCREEN_WIDTH 480
29 #define SCREEN_HEIGHT 320
30 #else
31 #define SCREEN_WIDTH 512
32 #define SCREEN_HEIGHT 320
33 #endif
34 
35 /* This is indexed by SDL_GameControllerButton. */
36 static const struct { int x; int y; } button_positions[] = {
37  {387, 167}, /* A */
38  {431, 132}, /* B */
39  {342, 132}, /* X */
40  {389, 101}, /* Y */
41  {174, 132}, /* BACK */
42  {233, 132}, /* GUIDE */
43  {289, 132}, /* START */
44  {75, 154}, /* LEFTSTICK */
45  {305, 230}, /* RIGHTSTICK */
46  {77, 40}, /* LEFTSHOULDER */
47  {396, 36}, /* RIGHTSHOULDER */
48  {154, 188}, /* DPAD_UP */
49  {154, 249}, /* DPAD_DOWN */
50  {116, 217}, /* DPAD_LEFT */
51  {186, 217}, /* DPAD_RIGHT */
52 };
53 
54 /* This is indexed by SDL_GameControllerAxis. */
55 static const struct { int x; int y; double angle; } axis_positions[] = {
56  {74, 153, 270.0}, /* LEFTX */
57  {74, 153, 0.0}, /* LEFTY */
58  {306, 231, 270.0}, /* RIGHTX */
59  {306, 231, 0.0}, /* RIGHTY */
60  {91, -20, 0.0}, /* TRIGGERLEFT */
61  {375, -20, 0.0}, /* TRIGGERRIGHT */
62 };
63 
68 
69 static SDL_Texture *
70 LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
71 {
72  SDL_Surface *temp = NULL;
74 
75  temp = SDL_LoadBMP(file);
76  if (temp == NULL) {
77  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
78  } else {
79  /* Set transparent pixel as the pixel at (0,0) */
80  if (transparent) {
81  if (temp->format->BytesPerPixel == 1) {
82  SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
83  }
84  }
85 
87  if (!texture) {
88  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
89  }
90  }
91  if (temp) {
92  SDL_FreeSurface(temp);
93  }
94  return texture;
95 }
96 
97 void
98 loop(void *arg)
99 {
101  int i;
102  SDL_GameController *gamecontroller = (SDL_GameController *)arg;
103 
104  /* blank screen, set up for drawing this frame. */
105  SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE);
108 
109  while (SDL_PollEvent(&event)) {
110  switch (event.type) {
112  SDL_Log("Controller axis %s changed to %d\n", SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value);
113  break;
116  SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
117  break;
118  case SDL_KEYDOWN:
119  if (event.key.keysym.sym != SDLK_ESCAPE) {
120  break;
121  }
122  /* Fall through to signal quit */
123  case SDL_QUIT:
124  done = SDL_TRUE;
125  break;
126  default:
127  break;
128  }
129  }
130 
131  /* Update visual controller state */
132  for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; ++i) {
134  const SDL_Rect dst = { button_positions[i].x, button_positions[i].y, 50, 50 };
136  }
137  }
138 
139  for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; ++i) {
140  const Sint16 deadzone = 8000; /* !!! FIXME: real deadzone */
141  const Sint16 value = SDL_GameControllerGetAxis(gamecontroller, (SDL_GameControllerAxis)(i));
142  if (value < -deadzone) {
143  const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
144  const double angle = axis_positions[i].angle;
146  } else if (value > deadzone) {
147  const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
148  const double angle = axis_positions[i].angle + 180.0;
150  }
151  }
152 
153  /* Update rumble based on trigger state */
154  {
155  Uint16 low_frequency_rumble = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_TRIGGERLEFT) * 2;
156  Uint16 high_frequency_rumble = SDL_GameControllerGetAxis(gamecontroller, SDL_CONTROLLER_AXIS_TRIGGERRIGHT) * 2;
157  SDL_GameControllerRumble(gamecontroller, low_frequency_rumble, high_frequency_rumble, 250);
158  }
159 
161 
162  if (!SDL_GameControllerGetAttached(gamecontroller)) {
163  done = SDL_TRUE;
164  retval = SDL_TRUE; /* keep going, wait for reattach. */
165  }
166 
167 #ifdef __EMSCRIPTEN__
168  if (done) {
169  emscripten_cancel_main_loop();
170  }
171 #endif
172 }
173 
174 SDL_bool
175 WatchGameController(SDL_GameController * gamecontroller)
176 {
177  const char *name = SDL_GameControllerName(gamecontroller);
178  const char *basetitle = "Game Controller Test: ";
179  const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(name) + 1;
180  char *title = (char *)SDL_malloc(titlelen);
182 
183  retval = SDL_FALSE;
184  done = SDL_FALSE;
185 
186  if (title) {
187  SDL_snprintf(title, titlelen, "%s%s", basetitle, name);
188  }
189 
190  /* Create a window to display controller state */
193  SCREEN_HEIGHT, 0);
194  SDL_free(title);
195  title = NULL;
196  if (window == NULL) {
197  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
198  return SDL_FALSE;
199  }
200 
201  screen = SDL_CreateRenderer(window, -1, 0);
202  if (screen == NULL) {
203  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
205  return SDL_FALSE;
206  }
207 
208  SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
212 
213  /* scale for platforms that don't give you the window size you asked for. */
215 
216  background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE);
217  button = LoadTexture(screen, "button.bmp", SDL_TRUE);
218  axis = LoadTexture(screen, "axis.bmp", SDL_TRUE);
219 
220  if (!background || !button || !axis) {
223  return SDL_FALSE;
224  }
225  SDL_SetTextureColorMod(button, 10, 255, 21);
226  SDL_SetTextureColorMod(axis, 10, 255, 21);
227 
228  /* !!! FIXME: */
229  /*SDL_RenderSetLogicalSize(screen, background->w, background->h);*/
230 
231  /* Print info about the controller we are watching */
232  SDL_Log("Watching controller %s\n", name ? name : "Unknown Controller");
233 
234  /* Loop, getting controller events! */
235 #ifdef __EMSCRIPTEN__
236  emscripten_set_main_loop_arg(loop, gamecontroller, 0, 1);
237 #else
238  while (!done) {
239  loop(gamecontroller);
240  }
241 #endif
242 
244  screen = NULL;
245  background = NULL;
246  button = NULL;
247  axis = NULL;
249  return retval;
250 }
251 
252 int
253 main(int argc, char *argv[])
254 {
255  int i;
256  int nController = 0;
257  int retcode = 0;
258  char guid[64];
259  SDL_GameController *gamecontroller;
260 
261  /* Enable standard application logging */
263 
264  /* Initialize SDL (Note: video is required to start event loop) */
266  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
267  return 1;
268  }
269 
270  SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
271 
272  /* Print information about the mappings */
273  if (!argv[1]) {
274  SDL_Log("Supported mappings:\n");
275  for (i = 0; i < SDL_GameControllerNumMappings(); ++i) {
277  if (mapping) {
278  SDL_Log("\t%s\n", mapping);
279  SDL_free(mapping);
280  }
281  }
282  SDL_Log("\n");
283  }
284 
285  /* Print information about the controller */
286  for (i = 0; i < SDL_NumJoysticks(); ++i) {
287  const char *name;
288  const char *description;
289 
291  guid, sizeof (guid));
292 
293  if ( SDL_IsGameController(i) )
294  {
295  nController++;
299  description = "XBox 360 Controller";
300  break;
302  description = "XBox One Controller";
303  break;
305  description = "PS3 Controller";
306  break;
308  description = "PS4 Controller";
309  break;
311  description = "Nintendo Switch Pro Controller";
312  break;
313  default:
314  description = "Game Controller";
315  break;
316  }
317  } else {
319  description = "Joystick";
320  }
321  SDL_Log("%s %d: %s (guid %s, VID 0x%.4x, PID 0x%.4x, player index = %d)\n",
322  description, i, name ? name : "Unknown", guid,
324  }
325  SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", nController, SDL_NumJoysticks());
326 
327  if (argv[1]) {
328  SDL_bool reportederror = SDL_FALSE;
329  SDL_bool keepGoing = SDL_TRUE;
331  int device = atoi(argv[1]);
332  if (device >= SDL_NumJoysticks()) {
333  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%i is an invalid joystick index.\n", device);
334  retcode = 1;
335  } else {
337  guid, sizeof (guid));
338  SDL_Log("Attempting to open device %i, guid %s\n", device, guid);
339  gamecontroller = SDL_GameControllerOpen(device);
340 
341  if (gamecontroller != NULL) {
343  }
344 
345  while (keepGoing) {
346  if (gamecontroller == NULL) {
347  if (!reportederror) {
348  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open gamecontroller %d: %s\n", device, SDL_GetError());
349  retcode = 1;
350  keepGoing = SDL_FALSE;
351  reportederror = SDL_TRUE;
352  }
353  } else {
354  reportederror = SDL_FALSE;
355  keepGoing = WatchGameController(gamecontroller);
356  SDL_GameControllerClose(gamecontroller);
357  }
358 
359  gamecontroller = NULL;
360  if (keepGoing) {
361  SDL_Log("Waiting for attach\n");
362  }
363  while (keepGoing) {
365  if ((event.type == SDL_QUIT) || (event.type == SDL_FINGERDOWN)
366  || (event.type == SDL_MOUSEBUTTONDOWN)) {
367  keepGoing = SDL_FALSE;
368  } else if (event.type == SDL_CONTROLLERDEVICEADDED) {
369  gamecontroller = SDL_GameControllerOpen(event.cdevice.which);
370  if (gamecontroller != NULL) {
372  }
373  break;
374  }
375  }
376  }
377  }
378  }
379 
381 
382  return retcode;
383 }
384 
385 #else
386 
387 int
388 main(int argc, char *argv[])
389 {
390  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Joystick support.\n");
391  return 1;
392 }
393 
394 #endif
395 
396 /* vi: set ts=4 sw=4 expandtab: */
SDL.h
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_JoystickGetDeviceProduct
#define SDL_JoystickGetDeviceProduct
Definition: SDL_dynapi_overrides.h:610
SDL_GetError
#define SDL_GetError
Definition: SDL_dynapi_overrides.h:113
SDL_RenderPresent
#define SDL_RenderPresent
Definition: SDL_dynapi_overrides.h:346
screen
SDL_Renderer * screen
Definition: testgamecontroller.c:64
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:323
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_IsGameController
#define SDL_IsGameController
Definition: SDL_dynapi_overrides.h:138
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:71
SDL_GameControllerRumble
#define SDL_GameControllerRumble
Definition: SDL_dynapi_overrides.h:681
SDL_GameControllerGetAttached
#define SDL_GameControllerGetAttached
Definition: SDL_dynapi_overrides.h:142
SDL_WINDOWPOS_CENTERED
#define SDL_WINDOWPOS_CENTERED
Definition: SDL_video.h:138
SDL_GameControllerGetStringForButton
#define SDL_GameControllerGetStringForButton
Definition: SDL_dynapi_overrides.h:151
SDL_PollEvent
#define SDL_PollEvent
Definition: SDL_dynapi_overrides.h:122
SDL_GameControllerOpen
#define SDL_GameControllerOpen
Definition: SDL_dynapi_overrides.h:140
NULL
#define NULL
Definition: begin_code.h:167
SDL_ALPHA_OPAQUE
#define SDL_ALPHA_OPAQUE
Definition: SDL_pixels.h:46
SDL_Surface::pixels
void * pixels
Definition: SDL_surface.h:76
SDL_INIT_JOYSTICK
#define SDL_INIT_JOYSTICK
Definition: SDL.h:81
SDL_CONTROLLERBUTTONDOWN
@ SDL_CONTROLLERBUTTONDOWN
Definition: SDL_events.h:121
SDLK_ESCAPE
@ SDLK_ESCAPE
Definition: SDL_keycode.h:55
SDL_GameControllerName
#define SDL_GameControllerName
Definition: SDL_dynapi_overrides.h:141
SCREEN_HEIGHT
#define SCREEN_HEIGHT
Definition: testgamecontroller.c:32
SDL_NumJoysticks
#define SDL_NumJoysticks
Definition: SDL_dynapi_overrides.h:195
loop
void loop(void *arg)
Definition: testgamecontroller.c:98
angle
double angle
Definition: testgamecontroller.c:55
SDL_QuitSubSystem
#define SDL_QuitSubSystem
Definition: SDL_dynapi_overrides.h:56
SDL_JoystickGetGUIDString
#define SDL_JoystickGetGUIDString
Definition: SDL_dynapi_overrides.h:201
SDL_JoystickInstanceID
#define SDL_JoystickInstanceID
Definition: SDL_dynapi_overrides.h:204
SDL_JoystickNameForIndex
#define SDL_JoystickNameForIndex
Definition: SDL_dynapi_overrides.h:196
SDL_KEYDOWN
@ SDL_KEYDOWN
Definition: SDL_events.h:96
SDL_CreateWindow
#define SDL_CreateWindow
Definition: SDL_dynapi_overrides.h:514
SDL_GameControllerGetJoystick
#define SDL_GameControllerGetJoystick
Definition: SDL_dynapi_overrides.h:143
SDL_GameControllerNumMappings
#define SDL_GameControllerNumMappings
Definition: SDL_dynapi_overrides.h:619
SDL_CONTROLLERDEVICEADDED
@ SDL_CONTROLLERDEVICEADDED
Definition: SDL_events.h:123
main
int main(int argc, char *argv[])
Definition: testgamecontroller.c:253
SDL_LogError
#define SDL_LogError
Definition: SDL_dynapi_overrides.h:36
SDL_CONTROLLERAXISMOTION
@ SDL_CONTROLLERAXISMOTION
Definition: SDL_events.h:120
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:75
SDL_CONTROLLER_BUTTON_MAX
@ SDL_CONTROLLER_BUTTON_MAX
Definition: SDL_gamecontroller.h:364
SDL_CONTROLLER_TYPE_PS3
@ SDL_CONTROLLER_TYPE_PS3
Definition: SDL_gamecontroller.h:65
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
SDL_CreateTextureFromSurface
#define SDL_CreateTextureFromSurface
Definition: SDL_dynapi_overrides.h:307
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
Sint16
int16_t Sint16
Definition: SDL_stdinc.h:185
axis_positions
static const struct @282 axis_positions[]
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2652
SDL_JoystickGetDeviceGUID
#define SDL_JoystickGetDeviceGUID
Definition: SDL_dynapi_overrides.h:199
SDL_Renderer
Definition: SDL_sysrender.h:110
y
int y
Definition: testgamecontroller.c:36
SDL_FINGERDOWN
@ SDL_FINGERDOWN
Definition: SDL_events.h:128
SCREEN_WIDTH
#define SCREEN_WIDTH
Definition: testgamecontroller.c:31
SDL_CONTROLLER_TYPE_PS4
@ SDL_CONTROLLER_TYPE_PS4
Definition: SDL_gamecontroller.h:66
WatchGameController
SDL_bool WatchGameController(SDL_GameController *gamecontroller)
Definition: testgamecontroller.c:175
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_CONTROLLERBUTTONUP
@ SDL_CONTROLLERBUTTONUP
Definition: SDL_events.h:122
SDL_RenderCopy
#define SDL_RenderCopy
Definition: SDL_dynapi_overrides.h:343
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
SDL_CONTROLLER_AXIS_TRIGGERLEFT
@ SDL_CONTROLLER_AXIS_TRIGGERLEFT
Definition: SDL_gamecontroller.h:309
SDL_Log
#define SDL_Log
Definition: SDL_dynapi_overrides.h:31
mapping
GLenum GLenum GLenum GLenum mapping
Definition: SDL_opengl_glext.h:9377
SDL_LOG_CATEGORY_APPLICATION
@ SDL_LOG_CATEGORY_APPLICATION
Definition: SDL_log.h:66
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_QUIT
@ SDL_QUIT
Definition: SDL_events.h:60
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:663
SDL_SetTextureColorMod
#define SDL_SetTextureColorMod
Definition: SDL_dynapi_overrides.h:309
SDL_CONTROLLER_AXIS_MAX
@ SDL_CONTROLLER_AXIS_MAX
Definition: SDL_gamecontroller.h:311
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:446
SDL_GameControllerGetStringForAxis
#define SDL_GameControllerGetStringForAxis
Definition: SDL_dynapi_overrides.h:147
SDL_SetColorKey
#define SDL_SetColorKey
Definition: SDL_dynapi_overrides.h:453
SDL_GameControllerAxis
SDL_GameControllerAxis
Definition: SDL_gamecontroller.h:303
LoadTexture
static SDL_Texture * LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
Definition: testgamecontroller.c:70
x
int x
Definition: testgamecontroller.c:36
SDL_GameControllerFromInstanceID
#define SDL_GameControllerFromInstanceID
Definition: SDL_dynapi_overrides.h:594
SDL_RaiseWindow
#define SDL_RaiseWindow
Definition: SDL_dynapi_overrides.h:535
SDL_JoystickGetDevicePlayerIndex
#define SDL_JoystickGetDevicePlayerIndex
Definition: SDL_dynapi_overrides.h:701
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_RenderSetLogicalSize
#define SDL_RenderSetLogicalSize
Definition: SDL_dynapi_overrides.h:322
SDL_LoadBMP
#define SDL_LoadBMP(file)
Definition: SDL_surface.h:201
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_FLIP_NONE
@ SDL_FLIP_NONE
Definition: SDL_render.h:123
SDL_GameControllerClose
#define SDL_GameControllerClose
Definition: SDL_dynapi_overrides.h:154
axis
SDL_Texture * axis
Definition: testgamecontroller.c:67
SDL_GameControllerGetButton
#define SDL_GameControllerGetButton
Definition: SDL_dynapi_overrides.h:153
background
SDL_Texture * background
Definition: testgamecontroller.c:67
SDL_INIT_VIDEO
#define SDL_INIT_VIDEO
Definition: SDL.h:80
SDL_LOG_PRIORITY_INFO
@ SDL_LOG_PRIORITY_INFO
Definition: SDL_log.h:106
renderer
static SDL_Renderer * renderer
Definition: testaudiocapture.c:21
SDL_GameControllerMappingForIndex
#define SDL_GameControllerMappingForIndex
Definition: SDL_dynapi_overrides.h:620
SDL_RenderCopyEx
#define SDL_RenderCopyEx
Definition: SDL_dynapi_overrides.h:344
SDL_LogSetPriority
#define SDL_LogSetPriority
Definition: SDL_dynapi_overrides.h:236
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
done
SDL_bool done
Definition: testgamecontroller.c:66
SDL_snprintf
#define SDL_snprintf
Definition: SDL_dynapi_overrides.h:40
SDL_Rect
A rectangle, with the origin at the upper left (integer).
Definition: SDL_rect.h:78
SDL_WaitEvent
#define SDL_WaitEvent
Definition: SDL_dynapi_overrides.h:123
SDL_GameControllerTypeForIndex
#define SDL_GameControllerTypeForIndex
Definition: SDL_dynapi_overrides.h:734
SDL_Texture
Definition: SDL_sysrender.h:37
SDL_GameControllerNameForIndex
#define SDL_GameControllerNameForIndex
Definition: SDL_dynapi_overrides.h:139
SDL_RenderClear
#define SDL_RenderClear
Definition: SDL_dynapi_overrides.h:334
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:330
SDL_MOUSEBUTTONDOWN
@ SDL_MOUSEBUTTONDOWN
Definition: SDL_events.h:106
angle
GLfloat angle
Definition: SDL_opengl_glext.h:6100
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:393
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_CONTROLLER_TYPE_XBOX360
@ SDL_CONTROLLER_TYPE_XBOX360
Definition: SDL_gamecontroller.h:63
SDL_Event
General event structure.
Definition: SDL_events.h:559
SDL_INIT_GAMECONTROLLER
#define SDL_INIT_GAMECONTROLLER
Definition: SDL.h:83
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_GameControllerGetAxis
#define SDL_GameControllerGetAxis
Definition: SDL_dynapi_overrides.h:149
SDL_CONTROLLER_AXIS_TRIGGERRIGHT
@ SDL_CONTROLLER_AXIS_TRIGGERRIGHT
Definition: SDL_gamecontroller.h:310
SDL_CreateRenderer
#define SDL_CreateRenderer
Definition: SDL_dynapi_overrides.h:301
SDL_Init
#define SDL_Init
Definition: SDL_dynapi_overrides.h:54
SDL_DestroyRenderer
#define SDL_DestroyRenderer
Definition: SDL_dynapi_overrides.h:348
texture
GLenum GLenum GLuint texture
Definition: SDL_opengl_glext.h:1181
device
static SDL_AudioDeviceID device
Definition: loopwave.c:37
SDL_CONTROLLER_TYPE_XBOXONE
@ SDL_CONTROLLER_TYPE_XBOXONE
Definition: SDL_gamecontroller.h:64
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:73
SDL_GameControllerAddMappingsFromFile
#define SDL_GameControllerAddMappingsFromFile(file)
Definition: SDL_gamecontroller.h:138
SDL_DestroyWindow
#define SDL_DestroyWindow
Definition: SDL_dynapi_overrides.h:549
button
SDL_Texture * button
Definition: testgamecontroller.c:67
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
@ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
Definition: SDL_gamecontroller.h:67
i
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)
Definition: SDL_x11sym.h:50
button_positions
static const struct @281 button_positions[]
SDL_JoystickGetDeviceVendor
#define SDL_JoystickGetDeviceVendor
Definition: SDL_dynapi_overrides.h:609
SDL_GameControllerButton
SDL_GameControllerButton
Definition: SDL_gamecontroller.h:347