This commit is contained in:
Isuru Samarathunga
2025-10-21 23:24:14 +05:30
parent 2d5875d211
commit e40b1f120b
3 changed files with 14 additions and 2 deletions

View File

@ -74,7 +74,8 @@ namespace ia::iae
case SDL_EVENT_FINGER_MOTION:
case SDL_EVENT_MOUSE_MOTION:
s_pointerPosition = {event->motion.x, event->motion.y};
if((event->motion.x >= 1) && (event->motion.y >= 1))
s_pointerPosition = {event->motion.x, event->motion.y};
break;
case SDL_EVENT_MOUSE_BUTTON_DOWN:
@ -236,6 +237,10 @@ namespace ia::iae
STATIC CONSTEXPR INT16 DIRECTION_MAP_VERTICAL[] = {0, 1, 1, 1, 0, -1, -1, -1};
STATIC CONSTEXPR INT16 DIRECTION_MAP_HORIZONTAL[] = {1, 1, 0, -1, -1, -1, 0, 1};
const auto ps = g_onScreenGamepadState;
g_onScreenGamepadState.ThumbstickPosition *= Engine::GetSceneScalingFactor();
g_onScreenGamepadState.ThumbstickRadius *= Engine::GetSceneScalingFactor().x;
if (Engine::Input_IsPointerDown(g_onScreenGamepadState.ThumbstickPosition,
g_onScreenGamepadState.ThumbstickRadius))
g_onScreenGamepadState.KnobPosition =
@ -257,6 +262,9 @@ namespace ia::iae
s_verticalAxis = DIRECTION_MAP_VERTICAL[t];
s_horizontalAxis = DIRECTION_MAP_HORIZONTAL[t];
}
g_onScreenGamepadState.ThumbstickPosition = ps.ThumbstickPosition;
g_onScreenGamepadState.ThumbstickRadius = ps.ThumbstickRadius;
}
if (s_keyboardGamePadEnabled)