You can now scroll using the gamepad triggers

This commit is contained in:
JappaWakka 2022-11-01 17:37:38 +01:00
parent b015a3632d
commit 8f7c725b95
6 changed files with 21 additions and 6 deletions

View File

@ -53,7 +53,7 @@
Return (GamePad.GetState(CType(index, PlayerIndex)).IsConnected = True And Core.GameOptions.GamePadEnabled = True)
End Function
Public Shared Function HasControlerInput(Optional ByVal index As Integer = 0) As Boolean
Public Shared Function HasControllerInput(Optional ByVal index As Integer = 0) As Boolean
If IsConnected() = False Then
Return False
End If

View File

@ -350,7 +350,7 @@
Core.GameInstance.IsMouseVisible = True
End If
ElseIf Core.GameInstance.IsMouseVisible = True Then
If ControllerHandler.HasControlerInput() = True Or Controls.HasKeyboardInput() = True Then
If ControllerHandler.HasControllerInput() = True Or Controls.HasKeyboardInput() = True Then
Core.GameInstance.IsMouseVisible = False
End If
End If

View File

@ -222,7 +222,7 @@
End If
End If
Case ScreenStates.Stopped
If KeyBoardHandler.GetPressedKeys().Count > 0 Or ControllerHandler.HasControlerInput() = True Or Controls.Accept() = True Or Controls.Dismiss() = True Then
If KeyBoardHandler.GetPressedKeys().Count > 0 Or ControllerHandler.HasControllerInput() = True Or Controls.Accept() = True Or Controls.Dismiss() = True Then
SoundManager.PlaySound("select")
CloseScreen()
End If

View File

@ -229,7 +229,7 @@
Case ScreenStates.Idle
Me.UpdateIdle()
Case ScreenStates.Stopped
If KeyBoardHandler.GetPressedKeys().Count > 0 Or ControllerHandler.HasControlerInput() = True Or Controls.Accept() = True Or Controls.Dismiss() = True Then
If KeyBoardHandler.GetPressedKeys().Count > 0 Or ControllerHandler.HasControllerInput() = True Or Controls.Accept() = True Or Controls.Dismiss() = True Then
SoundManager.PlaySound("select")
Core.SetScreen(Me.PreScreen)
End If

View File

@ -133,7 +133,7 @@
Case ScreenStates.Idle
Me.UpdateIdle()
Case ScreenStates.Stopped
If KeyBoardHandler.GetPressedKeys().Count > 0 Or ControllerHandler.HasControlerInput() = True Or Controls.Accept() = True Or Controls.Dismiss() = True Then
If KeyBoardHandler.GetPressedKeys().Count > 0 Or ControllerHandler.HasControllerInput() = True Or Controls.Accept() = True Or Controls.Dismiss() = True Then
SoundManager.PlaySound("select")
Core.SetScreen(Me.PreScreen)
End If

View File

@ -221,7 +221,7 @@ Public Class OverworldCamera
Dim dy As Single = mState.Y - oldY
If gState.ThumbSticks.Right.Y <> 0.0F And Core.GameOptions.GamePadEnabled = True Then
dy = gState.ThumbSticks.Right.Y * 40.0F * -1.0F
dy = gState.ThumbSticks.Right.Y * 35.0F * -1.0F
End If
If _isFixed = False AndAlso (dx <> 0 OrElse dy <> 0) Then
@ -274,7 +274,14 @@ Public Class OverworldCamera
_scrollDirection = 1
_scrollSpeed += _scrollSpeed.Clamp(0, 0.01)
End If
If ControllerHandler.ButtonDown(Buttons.LeftTrigger) = True Then
If _scrollSpeed = 0.0F Or _scrollDirection <> 1 Then
_scrollSpeed = 0.002F
End If
_scrollDirection = 1
_scrollSpeed += _scrollSpeed.Clamp(0, 0.002F)
End If
If Controls.Up(True, False, True, False, False, False) = True Then
If _scrollSpeed = 0.0F Or _scrollDirection <> -1 Then
_scrollSpeed = 0.01F
@ -283,6 +290,14 @@ Public Class OverworldCamera
_scrollDirection = -1
_scrollSpeed += _scrollSpeed.Clamp(0, 0.01)
End If
If ControllerHandler.ButtonDown(Buttons.RightTrigger) = True Then
If _scrollSpeed = 0.0F Or _scrollDirection <> -1 Then
_scrollSpeed = 0.002F
End If
_scrollDirection = -1
_scrollSpeed += _scrollSpeed.Clamp(0, 0.002F)
End If
_scrollSpeed = _scrollSpeed.Clamp(0, 0.08)