controllermap.c
Go to the documentation of this file.
/*
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
/* Game controller mapping generator */
/* Gabriel Jacobo <gabomdq@gmail.com> */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#ifndef SDL_JOYSTICK_DISABLED
#ifdef __IPHONEOS__
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 480
#else
#define SCREEN_WIDTH 512
#define SCREEN_HEIGHT 317
#endif
#define MAP_WIDTH 512
#define MAP_HEIGHT 317
#define MARKER_BUTTON 1
#define MARKER_AXIS 2
typedef struct MappingStep
{
int x, y;
double angle;
int marker;
char *field;
int axis, button, hat, hat_value;
char mapping[4096];
}MappingStep;
SDL_Texture *
LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
{
SDL_Surface *temp;
SDL_Texture *texture;
/* Load the sprite image */
temp = SDL_LoadBMP(file);
if (temp == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
return NULL;
}
/* Set transparent pixel as the pixel at (0,0) */
if (transparent) {
if (temp->format->palette) {
SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels);
} else {
switch (temp->format->BitsPerPixel) {
case 15:
SDL_SetColorKey(temp, SDL_TRUE,
(*(Uint16 *) temp->pixels) & 0x00007FFF);
break;
case 16:
SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels);
break;
case 24:
SDL_SetColorKey(temp, SDL_TRUE,
(*(Uint32 *) temp->pixels) & 0x00FFFFFF);
break;
case 32:
SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels);
break;
}
}
}
/* Create textures from the image */
texture = SDL_CreateTextureFromSurface(renderer, temp);
if (!texture) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
SDL_FreeSurface(temp);
return NULL;
}
SDL_FreeSurface(temp);
/* We're ready to roll. :) */
return texture;
}
static SDL_bool
WatchJoystick(SDL_Joystick * joystick)
{
SDL_Window *window = NULL;
SDL_Renderer *screen = NULL;
SDL_Texture *background, *button, *axis, *marker;
const char *name = NULL;
SDL_bool retval = SDL_FALSE;
SDL_bool done = SDL_FALSE, next=SDL_FALSE;
SDL_Event event;
SDL_Rect dst;
int s, _s;
Uint8 alpha=200, alpha_step = -1;
Uint32 alpha_ticks = 0;
char mapping[4096], temp[4096];
MappingStep *step, *prev_step;
MappingStep steps[] = {
{342, 132, 0.0, MARKER_BUTTON, "x", -1, -1, -1, -1, ""},
{387, 167, 0.0, MARKER_BUTTON, "a", -1, -1, -1, -1, ""},
{431, 132, 0.0, MARKER_BUTTON, "b", -1, -1, -1, -1, ""},
{389, 101, 0.0, MARKER_BUTTON, "y", -1, -1, -1, -1, ""},
{174, 132, 0.0, MARKER_BUTTON, "back", -1, -1, -1, -1, ""},
{233, 132, 0.0, MARKER_BUTTON, "guide", -1, -1, -1, -1, ""},
{289, 132, 0.0, MARKER_BUTTON, "start", -1, -1, -1, -1, ""},
{116, 217, 0.0, MARKER_BUTTON, "dpleft", -1, -1, -1, -1, ""},
{154, 249, 0.0, MARKER_BUTTON, "dpdown", -1, -1, -1, -1, ""},
{186, 217, 0.0, MARKER_BUTTON, "dpright", -1, -1, -1, -1, ""},
{154, 188, 0.0, MARKER_BUTTON, "dpup", -1, -1, -1, -1, ""},
{77, 40, 0.0, MARKER_BUTTON, "leftshoulder", -1, -1, -1, -1, ""},
{91, 0, 0.0, MARKER_BUTTON, "lefttrigger", -1, -1, -1, -1, ""},
{396, 36, 0.0, MARKER_BUTTON, "rightshoulder", -1, -1, -1, -1, ""},
{375, 0, 0.0, MARKER_BUTTON, "righttrigger", -1, -1, -1, -1, ""},
{75, 154, 0.0, MARKER_BUTTON, "leftstick", -1, -1, -1, -1, ""},
{305, 230, 0.0, MARKER_BUTTON, "rightstick", -1, -1, -1, -1, ""},
{75, 154, 0.0, MARKER_AXIS, "leftx", -1, -1, -1, -1, ""},
{75, 154, 90.0, MARKER_AXIS, "lefty", -1, -1, -1, -1, ""},
{305, 230, 0.0, MARKER_AXIS, "rightx", -1, -1, -1, -1, ""},
{305, 230, 90.0, MARKER_AXIS, "righty", -1, -1, -1, -1, ""},
};
/* Create a window to display joystick axis position */
window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
SCREEN_HEIGHT, 0);
if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
return SDL_FALSE;
}
screen = SDL_CreateRenderer(window, -1, 0);
if (screen == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
SDL_DestroyWindow(window);
return SDL_FALSE;
}
background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE);
button = LoadTexture(screen, "button.bmp", SDL_TRUE);
axis = LoadTexture(screen, "axis.bmp", SDL_TRUE);
SDL_RaiseWindow(window);
/* scale for platforms that don't give you the window size you asked for. */
SDL_RenderSetLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT);
/* Print info about the joystick we are watching */
name = SDL_JoystickName(joystick);
SDL_Log("Watching joystick %d: (%s)\n", SDL_JoystickInstanceID(joystick),
name ? name : "Unknown Joystick");
SDL_Log("Joystick has %d axes, %d hats, %d balls, and %d buttons\n",
SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick),
SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick));
SDL_Log("\n\n\
====================================================================================\n\
Press the buttons on your controller when indicated\n\
(Your controller may look different than the picture)\n\
If you want to correct a mistake, press backspace or the back button on your device\n\
To skip a button, press SPACE or click/touch the screen\n\
To exit, press ESC\n\
====================================================================================\n");
/* Initialize mapping with GUID and name */
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), temp, SDL_arraysize(temp));
SDL_snprintf(mapping, SDL_arraysize(mapping), "%s,%s,platform:%s,",
temp, name ? name : "Unknown Joystick", SDL_GetPlatform());
/* Loop, getting joystick events! */
for(s=0; s<SDL_arraysize(steps) && !done;) {
/* blank screen, set up for drawing this frame. */
step = &steps[s];
SDL_strlcpy(step->mapping, mapping, SDL_arraysize(step->mapping));
step->axis = -1;
step->button = -1;
step->hat = -1;
step->hat_value = -1;
switch(step->marker) {
case MARKER_AXIS:
marker = axis;
break;
case MARKER_BUTTON:
marker = button;
break;
default:
break;
}
dst.x = step->x;
dst.y = step->y;
SDL_QueryTexture(marker, NULL, NULL, &dst.w, &dst.h);
next=SDL_FALSE;
SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE);
while (!done && !next) {
if (SDL_GetTicks() - alpha_ticks > 5) {
alpha_ticks = SDL_GetTicks();
alpha += alpha_step;
if (alpha == 255) {
alpha_step = -1;
}
if (alpha < 128) {
alpha_step = 1;
}
}
SDL_RenderClear(screen);
SDL_RenderCopy(screen, background, NULL, NULL);
SDL_SetTextureAlphaMod(marker, alpha);
SDL_SetTextureColorMod(marker, 10, 255, 21);
SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, 0);
SDL_RenderPresent(screen);
if (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_JOYAXISMOTION:
if ((event.jaxis.value > 20000 || event.jaxis.value < -20000) && event.jaxis.value != -32768) {
for (_s = 0; _s < s; _s++) {
if (steps[_s].axis == event.jaxis.axis) {
break;
}
}
if (_s == s) {
step->axis = event.jaxis.axis;
SDL_strlcat(mapping, step->field, SDL_arraysize(mapping));
SDL_snprintf(temp, SDL_arraysize(temp), ":a%u,", event.jaxis.axis);
SDL_strlcat(mapping, temp, SDL_arraysize(mapping));
s++;
next=SDL_TRUE;
}
}
break;
case SDL_JOYHATMOTION:
if (event.jhat.value == SDL_HAT_CENTERED) {
break; /* ignore centering, we're probably just coming back to the center from the previous item we set. */
}
for (_s = 0; _s < s; _s++) {
if (steps[_s].hat == event.jhat.hat && steps[_s].hat_value == event.jhat.value) {
break;
}
}
if (_s == s) {
step->hat = event.jhat.hat;
step->hat_value = event.jhat.value;
SDL_strlcat(mapping, step->field, SDL_arraysize(mapping));
SDL_snprintf(temp, SDL_arraysize(temp), ":h%u.%u,", event.jhat.hat, event.jhat.value );
SDL_strlcat(mapping, temp, SDL_arraysize(mapping));
s++;
next=SDL_TRUE;
}
break;
case SDL_JOYBALLMOTION:
break;
case SDL_JOYBUTTONUP:
for (_s = 0; _s < s; _s++) {
if (steps[_s].button == event.jbutton.button) {
break;
}
}
if (_s == s) {
step->button = event.jbutton.button;
SDL_strlcat(mapping, step->field, SDL_arraysize(mapping));
SDL_snprintf(temp, SDL_arraysize(temp), ":b%u,", event.jbutton.button);
SDL_strlcat(mapping, temp, SDL_arraysize(mapping));
s++;
next=SDL_TRUE;
}
break;
case SDL_FINGERDOWN:
case SDL_MOUSEBUTTONDOWN:
/* Skip this step */
s++;
next=SDL_TRUE;
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) {
/* Undo! */
if (s > 0) {
prev_step = &steps[--s];
SDL_strlcpy(mapping, prev_step->mapping, SDL_arraysize(prev_step->mapping));
next = SDL_TRUE;
}
break;
}
if (event.key.keysym.sym == SDLK_SPACE) {
/* Skip this step */
s++;
next=SDL_TRUE;
break;
}
if ((event.key.keysym.sym != SDLK_ESCAPE)) {
break;
}
/* Fall through to signal quit */
case SDL_QUIT:
done = SDL_TRUE;
break;
default:
break;
}
}
}
}
if (s == SDL_arraysize(steps) ) {
SDL_Log("Mapping:\n\n%s\n\n", mapping);
/* Print to stdout as well so the user can cat the output somewhere */
printf("%s\n", mapping);
}
while(SDL_PollEvent(&event)) {};
SDL_DestroyRenderer(screen);
SDL_DestroyWindow(window);
return retval;
}
int
main(int argc, char *argv[])
{
const char *name;
int i;
SDL_Joystick *joystick;
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Initialize SDL (Note: video is required to start event loop) */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
/* Print information about the joysticks */
SDL_Log("There are %d joysticks attached\n", SDL_NumJoysticks());
for (i = 0; i < SDL_NumJoysticks(); ++i) {
name = SDL_JoystickNameForIndex(i);
SDL_Log("Joystick %d: %s\n", i, name ? name : "Unknown Joystick");
joystick = SDL_JoystickOpen(i);
if (joystick == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_JoystickOpen(%d) failed: %s\n", i,
SDL_GetError());
} else {
char guid[64];
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick),
guid, sizeof (guid));
SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick));
SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick));
SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick));
SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick));
SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick));
SDL_Log(" guid: %s\n", guid);
SDL_JoystickClose(joystick);
}
}
#ifdef __ANDROID__
if (SDL_NumJoysticks() > 0) {
#else
if (argv[1]) {
#endif
SDL_bool reportederror = SDL_FALSE;
SDL_bool keepGoing = SDL_TRUE;
SDL_Event event;
int device;
#ifdef __ANDROID__
device = 0;
#else
device = atoi(argv[1]);
#endif
joystick = SDL_JoystickOpen(device);
while ( keepGoing ) {
if (joystick == NULL) {
if ( !reportederror ) {
SDL_Log("Couldn't open joystick %d: %s\n", device, SDL_GetError());
keepGoing = SDL_FALSE;
reportederror = SDL_TRUE;
}
} else {
reportederror = SDL_FALSE;
keepGoing = WatchJoystick(joystick);
SDL_JoystickClose(joystick);
}
joystick = NULL;
if (keepGoing) {
SDL_Log("Waiting for attach\n");
}
while (keepGoing) {
SDL_WaitEvent(&event);
if ((event.type == SDL_QUIT) || (event.type == SDL_FINGERDOWN)
|| (event.type == SDL_MOUSEBUTTONDOWN)) {
keepGoing = SDL_FALSE;
} else if (event.type == SDL_JOYDEVICEADDED) {
joystick = SDL_JoystickOpen(device);
break;
}
}
}
}
else {
SDL_Log("\n\nUsage: ./controllermap number\nFor example: ./controllermap 0\nOr: ./controllermap 0 >> gamecontrollerdb.txt");
}
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
return 0;
}
#else
int
main(int argc, char *argv[])
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Joystick support.\n");
exit(1);
}
#endif
MappingStep::hat_value
int hat_value
Definition: controllermap.c:44
SDL_JOYBUTTONUP
Definition: SDL_events.h:112
SDL_JoyAxisEvent::value
Sint16 value
Definition: SDL_events.h:285
SDL_strlcpy
#define SDL_strlcpy
Definition: SDL_dynapi_overrides.h:400
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SCREEN_HEIGHT
#define SCREEN_HEIGHT
Definition: controllermap.c:29
SDL_JOYHATMOTION
Definition: SDL_events.h:110
SDL_WINDOWPOS_CENTERED
#define SDL_WINDOWPOS_CENTERED
Definition: SDL_video.h:129
SDL_PollEvent
#define SDL_PollEvent
Definition: SDL_dynapi_overrides.h:128
SDL_KEYDOWN
Definition: SDL_events.h:93
SDL_GetError
#define SDL_GetError
Definition: SDL_dynapi_overrides.h:119
SDL_JoystickClose
#define SDL_JoystickClose
Definition: SDL_dynapi_overrides.h:221
SDLK_BACKSPACE
Definition: SDL_keycode.h:53
SDL_JoyAxisEvent::axis
Uint8 axis
Definition: SDL_events.h:281
SDL_strlcat
#define SDL_strlcat
Definition: SDL_dynapi_overrides.h:402
s
GLdouble s
Definition: SDL_opengl.h:2056
SCREEN_WIDTH
#define SCREEN_WIDTH
Definition: controllermap.c:28
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_JoystickGetGUID
#define SDL_JoystickGetGUID
Definition: SDL_dynapi_overrides.h:206
SDL_LoadBMP
#define SDL_LoadBMP(file)
Definition: SDL_surface.h:182
SDL_INIT_JOYSTICK
#define SDL_INIT_JOYSTICK
Definition: SDL.h:78
SDL_Event::jbutton
SDL_JoyButtonEvent jbutton
Definition: SDL_events.h:535
window
SDL_Window * window
Definition: testautomation_render.c:26
SDL_JOYDEVICEADDED
Definition: SDL_events.h:113
texture
GLenum GLenum GLuint texture
Definition: SDL_opengl_glext.h:1178
SDL_QuitSubSystem
#define SDL_QuitSubSystem
Definition: SDL_dynapi_overrides.h:62
SDL_JoystickNameForIndex
#define SDL_JoystickNameForIndex
Definition: SDL_dynapi_overrides.h:202
SDL_MOUSEBUTTONDOWN
Definition: SDL_events.h:103
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_QUIT
Definition: SDL_events.h:60
SDL_Renderer
Definition: SDL_sysrender.h:76
MARKER_AXIS
#define MARKER_AXIS
Definition: controllermap.c:36
SDL_JoystickOpen
#define SDL_JoystickOpen
Definition: SDL_dynapi_overrides.h:203
SDL_NumJoysticks
#define SDL_NumJoysticks
Definition: SDL_dynapi_overrides.h:201
SDL_JoystickNumButtons
#define SDL_JoystickNumButtons
Definition: SDL_dynapi_overrides.h:214
SDL_JOYBALLMOTION
Definition: SDL_events.h:109
SDL_CreateWindow
#define SDL_CreateWindow
Definition: SDL_dynapi_overrides.h:518
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
background
SDL_Texture * background
Definition: testgamecontroller.c:67
SDL_JOYAXISMOTION
Definition: SDL_events.h:108
SDL_JoystickGetGUIDString
#define SDL_JoystickGetGUIDString
Definition: SDL_dynapi_overrides.h:207
SDL_JoystickInstanceID
#define SDL_JoystickInstanceID
Definition: SDL_dynapi_overrides.h:210
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:412
SDL_Texture
Definition: SDL_sysrender.h:49
SDL_JoystickName
#define SDL_JoystickName
Definition: SDL_dynapi_overrides.h:204
SDL_LogError
#define SDL_LogError
Definition: SDL_dynapi_overrides.h:42
SDL_JoystickNumAxes
#define SDL_JoystickNumAxes
Definition: SDL_dynapi_overrides.h:211
MappingStep::angle
double angle
Definition: controllermap.c:41
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_RenderCopy
#define SDL_RenderCopy
Definition: SDL_dynapi_overrides.h:349
renderer
SDL_Renderer * renderer
Definition: testautomation_render.c:27
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_Log
#define SDL_Log
Definition: SDL_dynapi_overrides.h:37
SDL_FINGERDOWN
Definition: SDL_events.h:125
LoadTexture
SDL_Texture * LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
Definition: controllermap.c:50
SDL_CreateTextureFromSurface
#define SDL_CreateTextureFromSurface
Definition: SDL_dynapi_overrides.h:313
SDL_GetTicks
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
SDL_Surface::pixels
void * pixels
Definition: SDL_surface.h:75
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:450
SDL_Event::jaxis
SDL_JoyAxisEvent jaxis
Definition: SDL_events.h:532
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
MappingStep::marker
int marker
Definition: controllermap.c:42
SDL_PixelFormat::BitsPerPixel
Uint8 BitsPerPixel
Definition: SDL_pixels.h:303
SDL_RenderSetLogicalSize
#define SDL_RenderSetLogicalSize
Definition: SDL_dynapi_overrides.h:328
SDL_RaiseWindow
#define SDL_RaiseWindow
Definition: SDL_dynapi_overrides.h:539
done
int done
Definition: checkkeys.c:28
SDL_QueryTexture
#define SDL_QueryTexture
Definition: SDL_dynapi_overrides.h:314
MappingStep::hat
int hat
Definition: controllermap.c:44
SDL_GetPlatform
#define SDL_GetPlatform
Definition: SDL_dynapi_overrides.h:297
SDL_SetColorKey
#define SDL_SetColorKey
Definition: SDL_dynapi_overrides.h:457
SDL_SetTextureColorMod
#define SDL_SetTextureColorMod
Definition: SDL_dynapi_overrides.h:315
SDL_LOG_PRIORITY_INFO
Definition: SDL_log.h:106
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_KeyboardEvent::keysym
SDL_Keysym keysym
Definition: SDL_events.h:196
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_Rect::w
int w
Definition: SDL_rect.h:67
MappingStep::axis
int axis
Definition: controllermap.c:44
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:42
SDL_LogSetPriority
#define SDL_LogSetPriority
Definition: SDL_dynapi_overrides.h:242
NULL
#define NULL
Definition: begin_code.h:143
MappingStep::button
int button
Definition: controllermap.c:44
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
SDL_JoystickNumHats
#define SDL_JoystickNumHats
Definition: SDL_dynapi_overrides.h:213
SDL_WaitEvent
#define SDL_WaitEvent
Definition: SDL_dynapi_overrides.h:129
SDL_JoyHatEvent::hat
Uint8 hat
Definition: SDL_events.h:313
SDL_RenderClear
#define SDL_RenderClear
Definition: SDL_dynapi_overrides.h:340
SDL_Event::key
SDL_KeyboardEvent key
Definition: SDL_events.h:526
SDL_Rect::h
int h
Definition: SDL_rect.h:67
MappingStep
Definition: controllermap.c:38
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_JoystickNumBalls
#define SDL_JoystickNumBalls
Definition: SDL_dynapi_overrides.h:212
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_JoyHatEvent::value
Uint8 value
Definition: SDL_events.h:314
SDL_RenderCopyEx
#define SDL_RenderCopyEx
Definition: SDL_dynapi_overrides.h:350
SDL_Keysym::sym
SDL_Keycode sym
Definition: SDL_keyboard.h:50
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
SDL_snprintf
#define SDL_snprintf
Definition: SDL_dynapi_overrides.h:46
SDLK_AC_BACK
Definition: SDL_keycode.h:296
SDL_Init
#define SDL_Init
Definition: SDL_dynapi_overrides.h:60
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:93
mapping
GLenum GLenum GLenum GLenum mapping
Definition: SDL_opengl_glext.h:9374
SDL_Event
General event structure.
Definition: SDL_events.h:521
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:336
SDL_PixelFormat::palette
SDL_Palette * palette
Definition: SDL_pixels.h:302
SDL_DestroyRenderer
#define SDL_DestroyRenderer
Definition: SDL_dynapi_overrides.h:354
main
int main(int argc, char *argv[])
Definition: controllermap.c:340
SDL_Event::jhat
SDL_JoyHatEvent jhat
Definition: SDL_events.h:534
SDL_JoyButtonEvent::button
Uint8 button
Definition: SDL_events.h:333
MappingStep::y
int y
Definition: controllermap.c:40
SDL_HAT_CENTERED
#define SDL_HAT_CENTERED
Definition: SDL_joystick.h:207
SDLK_ESCAPE
Definition: SDL_keycode.h:52
SDL_ALPHA_OPAQUE
#define SDL_ALPHA_OPAQUE
Definition: SDL_pixels.h:45
SDL.h
MappingStep::x
int x
Definition: controllermap.c:40
screen
SDL_Renderer * screen
Definition: testgamecontroller.c:64
MappingStep::mapping
char mapping[4096]
Definition: controllermap.c:45
SDL_DestroyWindow
#define SDL_DestroyWindow
Definition: SDL_dynapi_overrides.h:553
SDL_LOG_CATEGORY_APPLICATION
Definition: SDL_log.h:66
MARKER_BUTTON
#define MARKER_BUTTON
Definition: controllermap.c:35
SDL_Rect::y
int y
Definition: SDL_rect.h:66
SDLK_SPACE
Definition: SDL_keycode.h:55
SDL_INIT_VIDEO
#define SDL_INIT_VIDEO
Definition: SDL.h:77
SDL_CreateRenderer
#define SDL_CreateRenderer
Definition: SDL_dynapi_overrides.h:307
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
SDL_RenderPresent
#define SDL_RenderPresent
Definition: SDL_dynapi_overrides.h:352
SDL_SetTextureAlphaMod
#define SDL_SetTextureAlphaMod
Definition: SDL_dynapi_overrides.h:317
SDL_Event::type
Uint32 type
Definition: SDL_events.h:523
MappingStep::field
char * field
Definition: controllermap.c:43
WatchJoystick
static SDL_bool WatchJoystick(SDL_Joystick *joystick)
Definition: controllermap.c:100