src/joystick/SDL_joystick_c.h
author Michał Janiszewski <janisozaur+sdl2image@gmail.com>
Sun, 28 Oct 2018 21:36:48 +0100
changeset 12366 c46e72bd9950
parent 12192 f03ca3ab9b30
child 12503 806492103856
permissions -rw-r--r--
Add and update include guards

Include guards in most changed files were missing, I added them keeping
the same style as other SDL files. In some cases I moved the include
guards around to be the first thing the header has to take advantage of
any possible improvements compiler may have for inclusion guards.
slouken@0
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@11811
     3
  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
slouken@0
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@0
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@0
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@0
    20
*/
janisozaur+sdl2image@12366
    21
janisozaur+sdl2image@12366
    22
#ifndef SDL_joystick_c_h_
janisozaur+sdl2image@12366
    23
#define SDL_joystick_c_h_
janisozaur+sdl2image@12366
    24
icculus@8093
    25
#include "../SDL_internal.h"
slouken@0
    26
slouken@0
    27
/* Useful functions and variables from SDL_joystick.c */
slouken@0
    28
#include "SDL_joystick.h"
slouken@0
    29
slouken@12088
    30
struct _SDL_JoystickDriver;
slouken@12088
    31
slouken@4472
    32
/* Initialization and shutdown functions */
slouken@4472
    33
extern int SDL_JoystickInit(void);
slouken@4472
    34
extern void SDL_JoystickQuit(void);
slouken@4472
    35
slouken@12088
    36
/* Function to get the next available joystick instance ID */
slouken@12088
    37
extern SDL_JoystickID SDL_GetNextJoystickInstanceID(void);
slouken@12088
    38
slouken@6690
    39
/* Initialization and shutdown functions */
slouken@11201
    40
extern int SDL_GameControllerInitMappings(void);
slouken@11201
    41
extern void SDL_GameControllerQuitMappings(void);
slouken@6690
    42
extern int SDL_GameControllerInit(void);
slouken@6690
    43
extern void SDL_GameControllerQuit(void);
slouken@6690
    44
slouken@12088
    45
/* Function to get the joystick driver and device index for an API device index */
slouken@12088
    46
extern SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, struct _SDL_JoystickDriver **driver, int *driver_index);
slouken@12088
    47
slouken@12088
    48
/* Function to return the device index for a joystick ID, or -1 if not found */
slouken@12088
    49
extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id);
slouken@12088
    50
slouken@11201
    51
/* Function to extract information from an SDL joystick GUID */
slouken@11201
    52
extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version);
slouken@11201
    53
slouken@12088
    54
/* Function to return whether a joystick is a PS4 controller */
slouken@12088
    55
extern SDL_bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id);
slouken@12088
    56
slouken@12088
    57
/* Function to return whether a joystick is a Nintendo Switch Pro controller */
slouken@12088
    58
extern SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id);
slouken@12088
    59
slouken@12088
    60
/* Function to return whether a joystick is a Steam Controller */
slouken@12088
    61
extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id);
slouken@12088
    62
slouken@12088
    63
/* Function to return whether a joystick is an Xbox 360 controller */
slouken@12088
    64
extern SDL_bool SDL_IsJoystickXbox360(Uint16 vendor_id, Uint16 product_id);
slouken@12088
    65
slouken@12088
    66
/* Function to return whether a joystick is an Xbox One controller */
slouken@12088
    67
extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id);
slouken@12088
    68
slouken@12192
    69
/* Function to return whether a joystick guid comes from the XInput driver */
slouken@12192
    70
extern SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid);
slouken@12192
    71
slouken@12192
    72
/* Function to return whether a joystick guid comes from the HIDAPI driver */
slouken@12192
    73
extern SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid);
slouken@12192
    74
slouken@12088
    75
/* Function to return whether a joystick should be ignored */
slouken@12088
    76
extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid);
slouken@12088
    77
slouken@11201
    78
/* Function to return whether a joystick name and GUID is a game controller  */
slouken@11201
    79
extern SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid);
slouken@11201
    80
slouken@11201
    81
/* Function to return whether a game controller should be ignored */
slouken@11201
    82
extern SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid);
slouken@11201
    83
slouken@11934
    84
/* Handle delayed guide button on a game controller */
slouken@11934
    85
extern void SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick);
slouken@11934
    86
slouken@0
    87
/* Internal event queueing functions */
slouken@12088
    88
extern void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance);
slouken@10226
    89
extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance);
slouken@1895
    90
extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick,
slouken@0
    91
                                   Uint8 axis, Sint16 value);
slouken@1895
    92
extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick,
slouken@0
    93
                                   Uint8 ball, Sint16 xrel, Sint16 yrel);
slouken@1895
    94
extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
slouken@1895
    95
                                  Uint8 hat, Uint8 value);
slouken@1895
    96
extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
slouken@0
    97
                                     Uint8 button, Uint8 state);
slouken@10226
    98
extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick,
slouken@10226
    99
                                            SDL_JoystickPowerLevel ePowerLevel);
slouken@7191
   100
slouken@2713
   101
/* Internal sanity checking functions */
slouken@6690
   102
extern int SDL_PrivateJoystickValid(SDL_Joystick * joystick);
slouken@2713
   103
janisozaur+sdl2image@12366
   104
#endif /* SDL_joystick_c_h_ */
janisozaur+sdl2image@12366
   105
slouken@1895
   106
/* vi: set ts=4 sw=4 expandtab: */