22 #ifndef SDL_JOYSTICK_DISABLED 25 #define SCREEN_WIDTH 320 26 #define SCREEN_HEIGHT 480 28 #define SCREEN_WIDTH 512 29 #define SCREEN_HEIGHT 317 33 #define MAP_HEIGHT 317 35 #define MARKER_BUTTON 1 111 Uint8 alpha=200, alpha_step = -1;
113 char mapping[4096], temp[4096];
116 {342, 132, 0.0,
MARKER_BUTTON,
"x", -1, -1, -1, -1,
""},
117 {387, 167, 0.0,
MARKER_BUTTON,
"a", -1, -1, -1, -1,
""},
118 {431, 132, 0.0,
MARKER_BUTTON,
"b", -1, -1, -1, -1,
""},
119 {389, 101, 0.0,
MARKER_BUTTON,
"y", -1, -1, -1, -1,
""},
120 {174, 132, 0.0,
MARKER_BUTTON,
"back", -1, -1, -1, -1,
""},
121 {233, 132, 0.0,
MARKER_BUTTON,
"guide", -1, -1, -1, -1,
""},
122 {289, 132, 0.0,
MARKER_BUTTON,
"start", -1, -1, -1, -1,
""},
123 {116, 217, 0.0,
MARKER_BUTTON,
"dpleft", -1, -1, -1, -1,
""},
124 {154, 249, 0.0,
MARKER_BUTTON,
"dpdown", -1, -1, -1, -1,
""},
125 {186, 217, 0.0,
MARKER_BUTTON,
"dpright", -1, -1, -1, -1,
""},
126 {154, 188, 0.0,
MARKER_BUTTON,
"dpup", -1, -1, -1, -1,
""},
127 {77, 40, 0.0,
MARKER_BUTTON,
"leftshoulder", -1, -1, -1, -1,
""},
128 {91, 0, 0.0,
MARKER_BUTTON,
"lefttrigger", -1, -1, -1, -1,
""},
129 {396, 36, 0.0,
MARKER_BUTTON,
"rightshoulder", -1, -1, -1, -1,
""},
130 {375, 0, 0.0,
MARKER_BUTTON,
"righttrigger", -1, -1, -1, -1,
""},
131 {75, 154, 0.0,
MARKER_BUTTON,
"leftstick", -1, -1, -1, -1,
""},
132 {305, 230, 0.0,
MARKER_BUTTON,
"rightstick", -1, -1, -1, -1,
""},
133 {75, 154, 0.0,
MARKER_AXIS,
"leftx", -1, -1, -1, -1,
""},
134 {75, 154, 90.0,
MARKER_AXIS,
"lefty", -1, -1, -1, -1,
""},
135 {305, 230, 0.0,
MARKER_AXIS,
"rightx", -1, -1, -1, -1,
""},
136 {305, 230, 90.0,
MARKER_AXIS,
"righty", -1, -1, -1, -1,
""},
143 if (window ==
NULL) {
149 if (screen ==
NULL) {
166 name ? name :
"Unknown Joystick");
167 SDL_Log(
"Joystick has %d axes, %d hats, %d balls, and %d buttons\n",
172 ====================================================================================\n\ 173 Press the buttons on your controller when indicated\n\ 174 (Your controller may look different than the picture)\n\ 175 If you want to correct a mistake, press backspace or the back button on your device\n\ 176 To skip a button, press SPACE or click/touch the screen\n\ 177 To exit, press ESC\n\ 178 ====================================================================================\n");
213 while (!done && !next) {
233 switch (event.
type) {
236 for (_s = 0; _s <
s; _s++) {
237 if (steps[_s].axis == event.
jaxis.
axis) {
242 step->
axis =
event.jaxis.axis;
256 for (_s = 0; _s <
s; _s++) {
262 step->
hat =
event.jhat.hat;
274 for (_s = 0; _s <
s; _s++) {
280 step->
button =
event.jbutton.button;
298 prev_step = &steps[--
s];
327 SDL_Log(
"Mapping:\n\n%s\n\n", mapping);
329 printf(
"%s\n", mapping);
344 SDL_Joystick *joystick;
359 SDL_Log(
"Joystick %d: %s\n", i, name ? name :
"Unknown Joystick");
361 if (joystick ==
NULL) {
367 guid,
sizeof (guid));
390 device = atoi(argv[1]);
394 while ( keepGoing ) {
395 if (joystick ==
NULL) {
396 if ( !reportederror ) {
409 SDL_Log(
"Waiting for attach\n");
424 SDL_Log(
"\n\nUsage: ./controllermap number\nFor example: ./controllermap 0\nOr: ./controllermap 0 >> gamecontrollerdb.txt");
434 main(
int argc,
char *argv[])
#define SDL_WINDOWPOS_CENTERED
#define SDL_JoystickClose
uint32_t Uint32
An unsigned 32-bit integer type.
#define SDL_JoystickGetGUID
#define SDL_LoadBMP(file)
#define SDL_INIT_JOYSTICK
SDL_JoyButtonEvent jbutton
GLenum GLenum GLuint texture
#define SDL_QuitSubSystem
#define SDL_JoystickNameForIndex
A collection of pixels used in software blitting.
#define SDL_JoystickNumButtons
GLuint const GLchar * name
#define SDL_JoystickGetGUIDString
#define SDL_JoystickInstanceID
#define SDL_JoystickNumAxes
SDL_Texture * LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
#define SDL_CreateTextureFromSurface
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
uint8_t Uint8
An unsigned 8-bit integer type.
#define SDL_RenderSetLogicalSize
#define SDL_SetTextureColorMod
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_LogSetPriority
#define SDL_JoystickNumHats
The type used to identify a window.
#define SDL_JoystickNumBalls
uint16_t Uint16
An unsigned 16-bit integer type.
#define SDL_arraysize(array)
GLenum GLenum GLenum GLenum mapping
GLfloat GLfloat GLfloat sw_64
#define SDL_SetRenderDrawColor
#define SDL_DestroyRenderer
int main(int argc, char *argv[])
#define SDL_DestroyWindow
#define SDL_CreateRenderer
A rectangle, with the origin at the upper left.
#define SDL_RenderPresent
#define SDL_SetTextureAlphaMod
static SDL_bool WatchJoystick(SDL_Joystick *joystick)