SDL  2.0
testgamecontroller.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
+ Include dependency graph for testgamecontroller.c:

Go to the source code of this file.

Macros

#define SCREEN_WIDTH   512
 
#define SCREEN_HEIGHT   320
 

Functions

static SDL_TextureLoadTexture (SDL_Renderer *renderer, const char *file, SDL_bool transparent)
 
void loop (void *arg)
 
SDL_bool WatchGameController (SDL_GameController *gamecontroller)
 
int main (int argc, char *argv[])
 

Variables

struct {
   int   x
 
   int   y
 
button_positions []
 
struct {
   int   x
 
   int   y
 
   double   angle
 
axis_positions []
 
SDL_Rendererscreen = NULL
 
SDL_bool retval = SDL_FALSE
 
SDL_bool done = SDL_FALSE
 
SDL_Texturebackground
 
SDL_Texturebutton
 
SDL_Textureaxis
 

Macro Definition Documentation

◆ SCREEN_HEIGHT

#define SCREEN_HEIGHT   320

Definition at line 32 of file testgamecontroller.c.

◆ SCREEN_WIDTH

#define SCREEN_WIDTH   512

Definition at line 31 of file testgamecontroller.c.

Function Documentation

◆ LoadTexture()

static SDL_Texture* LoadTexture ( SDL_Renderer renderer,
const char *  file,
SDL_bool  transparent 
)
static

Definition at line 70 of file testgamecontroller.c.

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 }

References SDL_PixelFormat::BytesPerPixel, SDL_Surface::format, NULL, SDL_Surface::pixels, renderer, SDL_CreateTextureFromSurface, SDL_FreeSurface, SDL_GetError, SDL_LoadBMP, SDL_LOG_CATEGORY_APPLICATION, SDL_LogError, SDL_SetColorKey, and SDL_TRUE.

Referenced by WatchGameController().

◆ loop()

void loop ( void arg)

Definition at line 98 of file testgamecontroller.c.

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  /* First button triggers a 0.5 second full strength rumble */
118  if (event.type == SDL_CONTROLLERBUTTONDOWN &&
119  event.cbutton.button == SDL_CONTROLLER_BUTTON_A) {
120  SDL_GameControllerRumble(gamecontroller, 0xFFFF, 0xFFFF, 500);
121  }
122  break;
123  case SDL_KEYDOWN:
124  if (event.key.keysym.sym != SDLK_ESCAPE) {
125  break;
126  }
127  /* Fall through to signal quit */
128  case SDL_QUIT:
129  done = SDL_TRUE;
130  break;
131  default:
132  break;
133  }
134  }
135 
136  /* Update visual controller state */
137  for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; ++i) {
139  const SDL_Rect dst = { button_positions[i].x, button_positions[i].y, 50, 50 };
141  }
142  }
143 
144  for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; ++i) {
145  const Sint16 deadzone = 8000; /* !!! FIXME: real deadzone */
146  const Sint16 value = SDL_GameControllerGetAxis(gamecontroller, (SDL_GameControllerAxis)(i));
147  if (value < -deadzone) {
148  const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
149  const double angle = axis_positions[i].angle;
151  } else if (value > deadzone) {
152  const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 };
153  const double angle = axis_positions[i].angle + 180.0;
155  }
156  }
157 
159 
160  if (!SDL_GameControllerGetAttached(gamecontroller)) {
161  done = SDL_TRUE;
162  retval = SDL_TRUE; /* keep going, wait for reattach. */
163  }
164 
165 #ifdef __EMSCRIPTEN__
166  if (done) {
167  emscripten_cancel_main_loop();
168  }
169 #endif
170 }

References axis, axis_positions, background, button, button_positions, done, i, NULL, retval, screen, SDL_ALPHA_OPAQUE, SDL_CONTROLLER_AXIS_MAX, SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_MAX, SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, SDL_FLIP_NONE, SDL_GameControllerGetAttached, SDL_GameControllerGetAxis, SDL_GameControllerGetButton, SDL_GameControllerGetStringForAxis, SDL_GameControllerGetStringForButton, SDL_GameControllerRumble, SDL_KEYDOWN, SDL_Log, SDL_PollEvent, SDL_PRESSED, SDL_QUIT, SDL_RenderClear, SDL_RenderCopy, SDL_RenderCopyEx, SDL_RenderPresent, SDL_SetRenderDrawColor, SDL_TRUE, and SDLK_ESCAPE.

Referenced by WatchGameController().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 251 of file testgamecontroller.c.

252 {
253  int i;
254  int nController = 0;
255  int retcode = 0;
256  char guid[64];
257  SDL_GameController *gamecontroller;
258 
259  /* Enable standard application logging */
261 
262  /* Initialize SDL (Note: video is required to start event loop) */
264  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
265  return 1;
266  }
267 
268  SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
269 
270  /* Print information about the mappings */
271  if (!argv[1]) {
272  SDL_Log("Supported mappings:\n");
273  for (i = 0; i < SDL_GameControllerNumMappings(); ++i) {
275  if (mapping) {
276  SDL_Log("\t%s\n", mapping);
277  SDL_free(mapping);
278  }
279  }
280  SDL_Log("\n");
281  }
282 
283  /* Print information about the controller */
284  for (i = 0; i < SDL_NumJoysticks(); ++i) {
285  const char *name;
286  const char *description;
287 
289  guid, sizeof (guid));
290 
291  if ( SDL_IsGameController(i) )
292  {
293  nController++;
295  description = "Controller";
296  } else {
298  description = "Joystick";
299  }
300  SDL_Log("%s %d: %s (guid %s, VID 0x%.4x, PID 0x%.4x)\n",
301  description, i, name ? name : "Unknown", guid,
303  }
304  SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", nController, SDL_NumJoysticks());
305 
306  if (argv[1]) {
307  SDL_bool reportederror = SDL_FALSE;
308  SDL_bool keepGoing = SDL_TRUE;
310  int device = atoi(argv[1]);
311  if (device >= SDL_NumJoysticks()) {
312  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%i is an invalid joystick index.\n", device);
313  retcode = 1;
314  } else {
316  guid, sizeof (guid));
317  SDL_Log("Attempting to open device %i, guid %s\n", device, guid);
318  gamecontroller = SDL_GameControllerOpen(device);
319 
320  if (gamecontroller != NULL) {
322  }
323 
324  while (keepGoing) {
325  if (gamecontroller == NULL) {
326  if (!reportederror) {
327  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open gamecontroller %d: %s\n", device, SDL_GetError());
328  retcode = 1;
329  keepGoing = SDL_FALSE;
330  reportederror = SDL_TRUE;
331  }
332  } else {
333  reportederror = SDL_FALSE;
334  keepGoing = WatchGameController(gamecontroller);
335  SDL_GameControllerClose(gamecontroller);
336  }
337 
338  gamecontroller = NULL;
339  if (keepGoing) {
340  SDL_Log("Waiting for attach\n");
341  }
342  while (keepGoing) {
344  if ((event.type == SDL_QUIT) || (event.type == SDL_FINGERDOWN)
345  || (event.type == SDL_MOUSEBUTTONDOWN)) {
346  keepGoing = SDL_FALSE;
347  } else if (event.type == SDL_CONTROLLERDEVICEADDED) {
348  gamecontroller = SDL_GameControllerOpen(event.cdevice.which);
349  if (gamecontroller != NULL) {
351  }
352  break;
353  }
354  }
355  }
356  }
357  }
358 
360 
361  return retcode;
362 }

References device, i, NULL, SDL_assert, SDL_CONTROLLERDEVICEADDED, SDL_FALSE, SDL_FINGERDOWN, SDL_free, SDL_GameControllerAddMappingsFromFile, SDL_GameControllerClose, SDL_GameControllerFromInstanceID, SDL_GameControllerGetJoystick, SDL_GameControllerMappingForIndex, SDL_GameControllerNameForIndex, SDL_GameControllerNumMappings, SDL_GameControllerOpen, SDL_GetError, SDL_Init, SDL_INIT_GAMECONTROLLER, SDL_INIT_JOYSTICK, SDL_INIT_VIDEO, SDL_IsGameController, SDL_JoystickGetDeviceGUID, SDL_JoystickGetDeviceProduct, SDL_JoystickGetDeviceVendor, SDL_JoystickGetGUIDString, SDL_JoystickInstanceID, SDL_JoystickNameForIndex, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, SDL_LogError, SDL_LogSetPriority, SDL_MOUSEBUTTONDOWN, SDL_NumJoysticks, SDL_QUIT, SDL_QuitSubSystem, SDL_TRUE, SDL_WaitEvent, and WatchGameController().

◆ WatchGameController()

SDL_bool WatchGameController ( SDL_GameController *  gamecontroller)

Definition at line 173 of file testgamecontroller.c.

174 {
175  const char *name = SDL_GameControllerName(gamecontroller);
176  const char *basetitle = "Game Controller Test: ";
177  const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(name) + 1;
178  char *title = (char *)SDL_malloc(titlelen);
180 
181  retval = SDL_FALSE;
182  done = SDL_FALSE;
183 
184  if (title) {
185  SDL_snprintf(title, titlelen, "%s%s", basetitle, name);
186  }
187 
188  /* Create a window to display controller state */
191  SCREEN_HEIGHT, 0);
192  SDL_free(title);
193  title = NULL;
194  if (window == NULL) {
195  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
196  return SDL_FALSE;
197  }
198 
199  screen = SDL_CreateRenderer(window, -1, 0);
200  if (screen == NULL) {
201  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
203  return SDL_FALSE;
204  }
205 
206  SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
210 
211  /* scale for platforms that don't give you the window size you asked for. */
213 
214  background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE);
215  button = LoadTexture(screen, "button.bmp", SDL_TRUE);
216  axis = LoadTexture(screen, "axis.bmp", SDL_TRUE);
217 
218  if (!background || !button || !axis) {
221  return SDL_FALSE;
222  }
223  SDL_SetTextureColorMod(button, 10, 255, 21);
224  SDL_SetTextureColorMod(axis, 10, 255, 21);
225 
226  /* !!! FIXME: */
227  /*SDL_RenderSetLogicalSize(screen, background->w, background->h);*/
228 
229  /* Print info about the controller we are watching */
230  SDL_Log("Watching controller %s\n", name ? name : "Unknown Controller");
231 
232  /* Loop, getting controller events! */
233 #ifdef __EMSCRIPTEN__
234  emscripten_set_main_loop_arg(loop, gamecontroller, 0, 1);
235 #else
236  while (!done) {
237  loop(gamecontroller);
238  }
239 #endif
240 
242  screen = NULL;
243  background = NULL;
244  button = NULL;
245  axis = NULL;
247  return retval;
248 }

References axis, background, button, done, LoadTexture(), loop(), NULL, retval, screen, SCREEN_HEIGHT, SCREEN_WIDTH, SDL_ALPHA_OPAQUE, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyRenderer, SDL_DestroyWindow, SDL_FALSE, SDL_free, SDL_GameControllerName, SDL_GetError, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LogError, SDL_malloc, SDL_RaiseWindow, SDL_RenderClear, SDL_RenderPresent, SDL_RenderSetLogicalSize, SDL_SetRenderDrawColor, SDL_SetTextureColorMod, SDL_snprintf, SDL_strlen, SDL_TRUE, and SDL_WINDOWPOS_CENTERED.

Referenced by main().

Variable Documentation

◆ angle

double angle

Definition at line 55 of file testgamecontroller.c.

◆ axis

◆ axis_positions

const { ... } axis_positions[]
Initial value:
= {
{74, 153, 270.0},
{74, 153, 0.0},
{306, 231, 270.0},
{306, 231, 0.0},
{91, -20, 0.0},
{375, -20, 0.0},
}

Referenced by loop().

◆ background

SDL_Texture* background

Definition at line 67 of file testgamecontroller.c.

Referenced by loop(), WatchGameController(), and WatchJoystick().

◆ button

◆ button_positions

const { ... } button_positions[]
Initial value:
= {
{387, 167},
{431, 132},
{342, 132},
{389, 101},
{174, 132},
{233, 132},
{289, 132},
{75, 154},
{305, 230},
{77, 40},
{396, 36},
{154, 188},
{154, 249},
{116, 217},
{186, 217},
}

Referenced by loop().

◆ done

Definition at line 66 of file testgamecontroller.c.

Referenced by loop(), and WatchGameController().

◆ retval

SDL_bool retval = SDL_FALSE

Definition at line 65 of file testgamecontroller.c.

Referenced by add_audio_device(), AllocateRenderCommand(), AllocateVertexGap(), FlushRenderCommands(), get_sdlapi_entry(), IMA_ADPCM_DecodeBlockData(), loop(), main(), PrepQueueCmdDraw(), QueueCmdCopy(), QueueCmdCopyEx(), QueueCmdDrawLines(), QueueCmdDrawPoints(), QueueCmdFillRects(), QueueCmdSetClipRect(), QueueCmdSetDrawColor(), QueueCmdSetViewport(), render(), RenderDrawLinesWithRects(), RenderDrawLinesWithRectsF(), RenderDrawPointsWithRects(), RenderDrawPointsWithRectsF(), SDL_AllocateRenderVertices(), SDL_AtomicCAS(), SDL_AtomicCASPtr(), SDL_BuildAudioTypeCVTFromFloat(), SDL_BuildAudioTypeCVTToFloat(), SDL_CondBroadcast(), SDL_CondSignal(), SDL_CondWaitTimeout(), SDL_GetAudioDeviceName(), SDL_GetNumAudioDevices(), SDL_GetPowerInfo(), SDL_GetQueuedAudioSize(), SDL_GL_LoadLibrary(), SDL_GL_MakeCurrent(), SDL_GL_SetAttribute(), SDL_JoystickGetBall(), SDL_NewAudioStream(), SDL_RenderClear(), SDL_RenderCopyExF(), SDL_RenderCopyF(), SDL_RenderDrawLines(), SDL_RenderDrawLinesF(), SDL_RenderDrawPoints(), SDL_RenderDrawPointsF(), SDL_RenderFillRects(), SDL_RenderFillRectsF(), SDL_RenderSetClipRect(), SDL_RenderSetViewport(), SDL_ResampleAudioStream(), SDL_ReserveSpaceInDataQueue(), SDL_SemPost(), SDL_SemTryWait(), SDL_SemWait(), SDL_SemWaitTimeout(), SDL_SetWindowOpacity(), SDL_ShowMessageBox(), SDL_SIMDAlloc(), SDL_snprintf(), SDL_TryLockMutex(), SDL_utf8strlen(), SDL_vsscanf(), SDL_Vulkan_LoadLibrary(), SW_RenderCopyEx(), TestWaitTimeout(), and WatchGameController().

◆ screen

◆ x

int x

Definition at line 36 of file testgamecontroller.c.

◆ y

int y

Definition at line 36 of file testgamecontroller.c.

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:320
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:70
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:139
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
SDL_LOG_CATEGORY_APPLICATION
@ SDL_LOG_CATEGORY_APPLICATION
Definition: SDL_log.h:66
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:80
SDL_CONTROLLERBUTTONDOWN
@ SDL_CONTROLLERBUTTONDOWN
Definition: SDL_events.h:121
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
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
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:73
SDL_CONTROLLER_BUTTON_MAX
@ SDL_CONTROLLER_BUTTON_MAX
Definition: SDL_gamecontroller.h:334
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDLK_ESCAPE
@ SDLK_ESCAPE
Definition: SDL_keycode.h:55
axis_positions
static const struct @288 axis_positions[]
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
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
SDL_JoystickGetDeviceGUID
#define SDL_JoystickGetDeviceGUID
Definition: SDL_dynapi_overrides.h:199
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
SDL_FINGERDOWN
@ SDL_FINGERDOWN
Definition: SDL_events.h:128
SCREEN_WIDTH
#define SCREEN_WIDTH
Definition: testgamecontroller.c:31
WatchGameController
SDL_bool WatchGameController(SDL_GameController *gamecontroller)
Definition: testgamecontroller.c:173
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_Log
#define SDL_Log
Definition: SDL_dynapi_overrides.h:31
mapping
GLenum GLenum GLenum GLenum mapping
Definition: SDL_opengl_glext.h:9374
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:660
SDL_SetTextureColorMod
#define SDL_SetTextureColorMod
Definition: SDL_dynapi_overrides.h:309
SDL_CONTROLLER_AXIS_MAX
@ SDL_CONTROLLER_AXIS_MAX
Definition: SDL_gamecontroller.h:281
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:272
LoadTexture
static SDL_Texture * LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
Definition: testgamecontroller.c:70
SDL_GameControllerFromInstanceID
#define SDL_GameControllerFromInstanceID
Definition: SDL_dynapi_overrides.h:594
SDL_RaiseWindow
#define SDL_RaiseWindow
Definition: SDL_dynapi_overrides.h:535
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_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:79
SDL_LOG_PRIORITY_INFO
@ SDL_LOG_PRIORITY_INFO
Definition: SDL_log.h:106
renderer
static SDL_Renderer * renderer
Definition: testaudiocapture.c:21
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
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:698
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:77
SDL_WaitEvent
#define SDL_WaitEvent
Definition: SDL_dynapi_overrides.h:123
SDL_Texture
Definition: SDL_sysrender.h:43
SDL_GameControllerNameForIndex
#define SDL_GameControllerNameForIndex
Definition: SDL_dynapi_overrides.h:139
SDL_FLIP_NONE
@ SDL_FLIP_NONE
Definition: SDL_render.h:113
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:6097
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:393
SDL_Event
General event structure.
Definition: SDL_events.h:557
SDL_INIT_GAMECONTROLLER
#define SDL_INIT_GAMECONTROLLER
Definition: SDL.h:82
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_GameControllerGetAxis
#define SDL_GameControllerGetAxis
Definition: SDL_dynapi_overrides.h:149
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:1178
device
static SDL_AudioDeviceID device
Definition: loopwave.c:37
SDL_CONTROLLER_BUTTON_A
@ SDL_CONTROLLER_BUTTON_A
Definition: SDL_gamecontroller.h:319
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:73
SDL_GameControllerAddMappingsFromFile
#define SDL_GameControllerAddMappingsFromFile(file)
Definition: SDL_gamecontroller.h:129
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
SDL_DestroyWindow
#define SDL_DestroyWindow
Definition: SDL_dynapi_overrides.h:549
button
SDL_Texture * button
Definition: testgamecontroller.c:67
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161
SDL_JoystickGetDeviceVendor
#define SDL_JoystickGetDeviceVendor
Definition: SDL_dynapi_overrides.h:609
SDL_GameControllerButton
SDL_GameControllerButton
Definition: SDL_gamecontroller.h:316
button_positions
static const struct @287 button_positions[]
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179