added a comment

This commit is contained in:
2023-02-10 19:22:38 +01:00
parent eee3897b85
commit f3e4300332

View File

@@ -5,7 +5,7 @@ public partial class essential : Node
{ {
public string currentController = Input.GetJoyName(0); public string currentController = Input.GetJoyName(0);
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
{ {
//Checks if using Keyboard or controller and giving out current controller //Checks if using Keyboard or controller and giving out current controller
if (@event is InputEventKey || @event is InputEventMouseButton || currentController == "") if (@event is InputEventKey || @event is InputEventMouseButton || currentController == "")
@@ -15,7 +15,10 @@ public partial class essential : Node
} }
public override void _Process(double delta) public override void _Process(double delta)
{ {
//CHANGE INPUT FOR NINTENDO CONTROLLER //CHANGE INPUT FOR NINTENDO CONTROLLER
/*TODO: shouldnt hard change the controlls everytime and only switch
the current input methods when the controller changes to make
custom controlls possible*/
InputEventJoypadButton JoyButtonA = new InputEventJoypadButton() { ButtonIndex = JoyButton.A }; InputEventJoypadButton JoyButtonA = new InputEventJoypadButton() { ButtonIndex = JoyButton.A };
InputEventJoypadButton JoyButtonB = new InputEventJoypadButton() { ButtonIndex = JoyButton.B }; InputEventJoypadButton JoyButtonB = new InputEventJoypadButton() { ButtonIndex = JoyButton.B };
if (currentController.StartsWith("Nintendo")) if (currentController.StartsWith("Nintendo"))
@@ -24,7 +27,8 @@ public partial class essential : Node
InputMap.ActionEraseEvent("ui_cancel", JoyButtonB); InputMap.ActionEraseEvent("ui_cancel", JoyButtonB);
InputMap.ActionAddEvent("ui_accept", JoyButtonB); InputMap.ActionAddEvent("ui_accept", JoyButtonB);
InputMap.ActionAddEvent("ui_cancel", JoyButtonA); InputMap.ActionAddEvent("ui_cancel", JoyButtonA);
} else }
else
{ {
InputMap.ActionEraseEvent("ui_accept", JoyButtonB); InputMap.ActionEraseEvent("ui_accept", JoyButtonB);
InputMap.ActionEraseEvent("ui_cancel", JoyButtonA); InputMap.ActionEraseEvent("ui_cancel", JoyButtonA);
@@ -35,9 +39,9 @@ public partial class essential : Node
//FULLSCREEN HOTKEY //FULLSCREEN HOTKEY
if (Input.IsActionJustPressed("hotkey_fullscreen")) if (Input.IsActionJustPressed("hotkey_fullscreen"))
{ {
if (DisplayServer.WindowGetMode() == DisplayServer.WindowMode.Fullscreen) if (DisplayServer.WindowGetMode() == DisplayServer.WindowMode.Fullscreen)
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed); DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed);
else DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen); else DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
} }
} }
} }