Split SDL gamepad internal functions into SDL_gamepad_c.h

This commit is contained in:
Sam Lantinga 2022-12-27 10:23:28 -08:00
parent 15b464747f
commit ad8a6d2b05
11 changed files with 63 additions and 17 deletions

View File

@ -403,6 +403,7 @@
<ClInclude Include="..\..\src\joystick\controller_type.h" /> <ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" /> <ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" /> <ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" /> <ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" /> <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" /> <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />

View File

@ -483,6 +483,9 @@
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h"> <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
<Filter>haptic</Filter> <Filter>haptic</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h">
<Filter>joystick</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h"> <ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h">
<Filter>joystick</Filter> <Filter>joystick</Filter>
</ClInclude> </ClInclude>

View File

@ -121,6 +121,7 @@
<ClInclude Include="..\src\haptic\windows\SDL_windowshaptic_c.h" /> <ClInclude Include="..\src\haptic\windows\SDL_windowshaptic_c.h" />
<ClInclude Include="..\src\haptic\windows\SDL_xinputhaptic_c.h" /> <ClInclude Include="..\src\haptic\windows\SDL_xinputhaptic_c.h" />
<ClInclude Include="..\src\joystick\controller_type.h" /> <ClInclude Include="..\src\joystick\controller_type.h" />
<ClInclude Include="..\src\joystick\SDL_gamepad_c.h" />
<ClInclude Include="..\src\joystick\SDL_gamepad_db.h" /> <ClInclude Include="..\src\joystick\SDL_gamepad_db.h" />
<ClInclude Include="..\src\joystick\SDL_joystick_c.h" /> <ClInclude Include="..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\src\joystick\SDL_sysjoystick.h" /> <ClInclude Include="..\src\joystick\SDL_sysjoystick.h" />

View File

@ -162,6 +162,9 @@
<ClInclude Include="..\include\SDL3\SDL_video.h"> <ClInclude Include="..\include\SDL3\SDL_video.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\joystick\SDL_gamepad_c.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\joystick\SDL_gamepad_db.h"> <ClInclude Include="..\src\joystick\SDL_gamepad_db.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -347,6 +347,7 @@
<ClInclude Include="..\..\src\joystick\controller_type.h" /> <ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" /> <ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" /> <ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" /> <ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" /> <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" /> <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />

View File

@ -477,6 +477,9 @@
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h"> <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
<Filter>haptic</Filter> <Filter>haptic</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h">
<Filter>joystick</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h"> <ClInclude Include="..\..\src\joystick\SDL_gamepad_db.h">
<Filter>joystick</Filter> <Filter>joystick</Filter>
</ClInclude> </ClInclude>

View File

@ -41,6 +41,7 @@
#include "video/SDL_video_c.h" #include "video/SDL_video_c.h"
#include "events/SDL_events_c.h" #include "events/SDL_events_c.h"
#include "haptic/SDL_haptic_c.h" #include "haptic/SDL_haptic_c.h"
#include "joystick/SDL_gamepad_c.h"
#include "joystick/SDL_joystick_c.h" #include "joystick/SDL_joystick_c.h"
#include "sensor/SDL_sensor_c.h" #include "sensor/SDL_sensor_c.h"

View File

@ -24,6 +24,7 @@
#include "SDL_sysjoystick.h" #include "SDL_sysjoystick.h"
#include "SDL_joystick_c.h" #include "SDL_joystick_c.h"
#include "SDL_gamepad_c.h"
#include "SDL_gamepad_db.h" #include "SDL_gamepad_db.h"
#include "controller_type.h" #include "controller_type.h"
#include "usb_ids.h" #include "usb_ids.h"

View File

@ -0,0 +1,45 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 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, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_gamepad_c_h_
#define SDL_gamepad_c_h_
#include "SDL_internal.h"
/* Useful functions and variables from SDL_gamepad.c */
/* Initialization and shutdown functions */
extern int SDL_GamepadInitMappings(void);
extern void SDL_GamepadQuitMappings(void);
extern int SDL_GamepadInit(void);
extern void SDL_GamepadQuit(void);
/* Function to return whether a joystick name and GUID is a gamepad */
extern SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_JoystickGUID guid);
/* Function to return whether a gamepad should be ignored */
extern SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid);
/* Handle delayed guide button on a gamepad */
extern void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick);
#endif /* SDL_gamepad_c_h_ */

View File

@ -24,6 +24,8 @@
#include "SDL_sysjoystick.h" #include "SDL_sysjoystick.h"
#include "../SDL_hints_c.h" #include "../SDL_hints_c.h"
#include "SDL_gamepad_c.h"
#include "SDL_joystick_c.h"
#if !SDL_EVENTS_DISABLED #if !SDL_EVENTS_DISABLED
#include "../events/SDL_events_c.h" #include "../events/SDL_events_c.h"

View File

@ -52,12 +52,6 @@ extern void SDL_AssertJoysticksLocked(void) SDL_ASSERT_CAPABILITY(SDL_joystick_l
/* Function to get the next available joystick instance ID */ /* Function to get the next available joystick instance ID */
extern SDL_JoystickID SDL_GetNextJoystickInstanceID(void); extern SDL_JoystickID SDL_GetNextJoystickInstanceID(void);
/* Initialization and shutdown functions */
extern int SDL_GamepadInitMappings(void);
extern void SDL_GamepadQuitMappings(void);
extern int SDL_GamepadInit(void);
extern void SDL_GamepadQuit(void);
/* Function to return the device index for a joystick ID, or -1 if not found */ /* Function to return the device index for a joystick ID, or -1 if not found */
extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id); extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id);
@ -137,15 +131,6 @@ extern SDL_bool SDL_IsJoystickVIRTUAL(SDL_JoystickGUID guid);
/* Function to return whether a joystick should be ignored */ /* Function to return whether a joystick should be ignored */
extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid); extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid);
/* Function to return whether a joystick name and GUID is a gamepad */
extern SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_JoystickGUID guid);
/* Function to return whether a gamepad should be ignored */
extern SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid);
/* Handle delayed guide button on a gamepad */
extern void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick);
/* Internal event queueing functions */ /* Internal event queueing functions */
extern void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers); extern void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers);
extern void SDL_PrivateJoystickAddSensor(SDL_Joystick *joystick, SDL_SensorType type, float rate); extern void SDL_PrivateJoystickAddSensor(SDL_Joystick *joystick, SDL_SensorType type, float rate);