now checks if you are using keyboard or gamepad (very badly)
This commit is contained in:
13
src/main.cs
13
src/main.cs
@@ -8,12 +8,21 @@ public partial class main : Node2D
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
GD.Print(Input.GetConnectedJoypads());
|
||||||
}
|
}
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
//CHANGE INPUT FOR NINTENDO CONTROLLER
|
//CHANGE INPUT FOR NINTENDO CONTROLLER
|
||||||
//TODO: set currentController to keyboard if keyboard for UI purposes and more
|
//Checks if using Keyboard or controller and giving out current controller
|
||||||
currentController = Input.GetJoyName(0);
|
if(Input.IsMouseButtonPressed(MouseButton.Left) || Input.IsMouseButtonPressed(MouseButton.Right))//this is a terrible way of doing this will be reworked
|
||||||
|
{
|
||||||
|
currentController = "PC";
|
||||||
|
}
|
||||||
|
if (Input.IsJoyButtonPressed(0, JoyButton.A) || Input.IsJoyButtonPressed(0, JoyButton.B))
|
||||||
|
{
|
||||||
|
currentController = Input.GetJoyName(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (currentController.StartsWith("Nintendo"))
|
if (currentController.StartsWith("Nintendo"))
|
||||||
{
|
{
|
||||||
InputMap.ActionAddEvent("ui_accept", new InputEventJoypadButton() { ButtonIndex = JoyButton.B});
|
InputMap.ActionAddEvent("ui_accept", new InputEventJoypadButton() { ButtonIndex = JoyButton.B});
|
||||||
|
Reference in New Issue
Block a user