full gamepad support
This commit is contained in:
parent
31ba172123
commit
a57d79e84a
21 changed files with 213 additions and 46 deletions
|
|
@ -35,9 +35,13 @@ public partial class Cursor : Node2D
|
|||
case CursorMode.Mouse:
|
||||
break;
|
||||
case CursorMode.Gamepad:
|
||||
if (GamepadHandler.Instance.IsGamepadControlled == false) return;
|
||||
|
||||
var vector = Input.GetVector("cursor_left", "cursor_right", "cursor_up", "cursor_down");
|
||||
|
||||
var set_position = GetGlobalMousePosition() + vector * (float)delta * sensitivity;
|
||||
if (vector == Vector2.Zero) return;
|
||||
|
||||
var set_position = GetGlobalMousePosition() + vector * (float)delta * sensitivity / (float)Engine.TimeScale;
|
||||
|
||||
GetViewport().WarpMouse(GetGlobalTransformWithCanvas() * set_position);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue