diff options
Diffstat (limited to 'src/SDL2/include/SDL_joystick.h')
-rw-r--r-- | src/SDL2/include/SDL_joystick.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/SDL2/include/SDL_joystick.h b/src/SDL2/include/SDL_joystick.h index 4214cef4..26674034 100644 --- a/src/SDL2/include/SDL_joystick.h +++ b/src/SDL2/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> + Copyright (C) 1997-2013 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 @@ -21,7 +21,7 @@ /** * \file SDL_joystick.h - * + * * Include file for SDL joystick event handling * * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick @@ -30,7 +30,7 @@ * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. * - * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of + * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of * the device (a X360 wired controller for example). This identifier is platform dependent. * * @@ -45,9 +45,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -56,6 +54,10 @@ extern "C" { * In order to use these functions, SDL_Init() must have been called * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system * for joysticks, and load appropriate drivers. + * + * If you would like to receive joystick updates while the application + * is in the background, you should set the following hint before calling + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ /* The joystick structure used to identify an SDL joystick */ @@ -64,10 +66,10 @@ typedef struct _SDL_Joystick SDL_Joystick; /* A structure that encodes the stable unique id for a joystick device */ typedef struct { - Uint8 data[16]; + Uint8 data[16]; } SDL_JoystickGUID; -typedef int SDL_JoystickID; +typedef Sint32 SDL_JoystickID; /* Function prototypes */ @@ -84,11 +86,11 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); /** - * Open a joystick for use. - * The index passed as an argument refers tothe N'th joystick on the system. + * Open a joystick for use. + * The index passed as an argument refers tothe N'th joystick on the system. * This index is the value which will identify this joystick in future joystick * events. - * + * * \return A joystick identifier, or NULL if an error occurred. */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); @@ -98,7 +100,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); * If no name can be found, this function returns NULL. */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); - + /** * Return the GUID for the joystick at this index */ @@ -126,7 +128,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick); /** - * Get the instance ID of an opened joystick. + * Get the instance ID of an opened joystick or -1 if the joystick is invalid. */ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick); @@ -137,7 +139,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick); /** * Get the number of trackballs on a joystick. - * + * * Joystick trackballs have only relative motion events associated * with them and their state cannot be polled. */ @@ -155,7 +157,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick); /** * Update the current state of the open joysticks. - * + * * This is called automatically by the event loop if any joystick * events are enabled. */ @@ -163,20 +165,20 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); /** * Enable/disable joystick event polling. - * + * * If joystick events are disabled, you must call SDL_JoystickUpdate() * yourself and check the state of the joystick when you want joystick * information. - * + * * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); /** * Get the current state of an axis control on a joystick. - * + * * The state is a value ranging from -32768 to 32767. - * + * * The axis indices start at index 0. */ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, @@ -186,22 +188,22 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, * \name Hat positions */ /*@{*/ -#define SDL_HAT_CENTERED 0x00 -#define SDL_HAT_UP 0x01 -#define SDL_HAT_RIGHT 0x02 -#define SDL_HAT_DOWN 0x04 -#define SDL_HAT_LEFT 0x08 -#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) -#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) -#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) -#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) /*@}*/ /** * Get the current state of a POV hat on a joystick. * * The hat indices start at index 0. - * + * * \return The return value is one of the following positions: * - ::SDL_HAT_CENTERED * - ::SDL_HAT_UP @@ -218,9 +220,9 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick, /** * Get the ball axis change since the last poll. - * + * * \return 0, or -1 if you passed it invalid parameters. - * + * * The ball indices start at index 0. */ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, @@ -228,7 +230,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, /** * Get the current state of a button on a joystick. - * + * * The button indices start at index 0. */ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, @@ -242,9 +244,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" |