[rcore] inline body of 'GetGamepadAxisMovementDefault' and remove it
This commit is contained in:
parent
ea3d0737a1
commit
675a072b34
10
src/rcore.c
10
src/rcore.c
|
|
@ -2949,15 +2949,10 @@ int GetGamepadAxisCount(int gamepad)
|
||||||
return CORE.Input.Gamepad.axisCount[gamepad];
|
return CORE.Input.Gamepad.axisCount[gamepad];
|
||||||
}
|
}
|
||||||
|
|
||||||
static float GetGamepadAxisMovementDefault(int axis)
|
|
||||||
{
|
|
||||||
return (axis == GAMEPAD_AXIS_LEFT_TRIGGER || axis == GAMEPAD_AXIS_RIGHT_TRIGGER) ? -1.0f : 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get axis movement vector for a gamepad
|
// Get axis movement vector for a gamepad
|
||||||
float GetGamepadAxisMovement(int gamepad, int axis)
|
float GetGamepadAxisMovement(int gamepad, int axis)
|
||||||
{
|
{
|
||||||
float value = GetGamepadAxisMovementDefault(axis);
|
float value = (axis == GAMEPAD_AXIS_LEFT_TRIGGER || axis == GAMEPAD_AXIS_RIGHT_TRIGGER)? -1.0f : 0.0f;
|
||||||
|
|
||||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (axis < MAX_GAMEPAD_AXIS)) {
|
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (axis < MAX_GAMEPAD_AXIS)) {
|
||||||
float movement = value < 0.0f ? CORE.Input.Gamepad.axisState[gamepad][axis] : fabs(CORE.Input.Gamepad.axisState[gamepad][axis]);
|
float movement = value < 0.0f ? CORE.Input.Gamepad.axisState[gamepad][axis] : fabs(CORE.Input.Gamepad.axisState[gamepad][axis]);
|
||||||
|
|
@ -3608,7 +3603,8 @@ static void RecordAutomationEvent(void)
|
||||||
for (int axis = 0; axis < MAX_GAMEPAD_AXIS; axis++)
|
for (int axis = 0; axis < MAX_GAMEPAD_AXIS; axis++)
|
||||||
{
|
{
|
||||||
// Event type: INPUT_GAMEPAD_AXIS_MOTION
|
// Event type: INPUT_GAMEPAD_AXIS_MOTION
|
||||||
if (GetGamepadAxisMovement(gamepad, axis) != GetGamepadAxisMovementDefault(axis))
|
float defaultMovement = (axis == GAMEPAD_AXIS_LEFT_TRIGGER || axis == GAMEPAD_AXIS_RIGHT_TRIGGER)? -1.0f : 0.0f;
|
||||||
|
if (GetGamepadAxisMovement(gamepad, axis) != defaultMovement)
|
||||||
{
|
{
|
||||||
currentEventList->events[currentEventList->count].frame = CORE.Time.frameCounter;
|
currentEventList->events[currentEventList->count].frame = CORE.Time.frameCounter;
|
||||||
currentEventList->events[currentEventList->count].type = INPUT_GAMEPAD_AXIS_MOTION;
|
currentEventList->events[currentEventList->count].type = INPUT_GAMEPAD_AXIS_MOTION;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user