0 votes

So I have a few questions regarding input.

Firstly, What is the difference between key and physical key?

And for controllers,
In the Devices section. That means what? Is that like if you have two Nintendo Switch controllers. One will be Device 0 and the other will be Device 1? And upto 8 Devices are supported?

So In the screenshot below. From number 23 onwards, they're empty. So are they missing or that's the limit to how many are supported.
enter image description here

How many controllers are supported? Playstation, Nintendo, xbox? And these companies have multiple consoles. From PS1 to 5.
Gamecube to Switch. Do they use similar 'input signal' over the different generations?

enter image description here

enter image description here

In the two screenshots above you can see the assigned keys appearing inside labels. I have stored the keys as string. And I display this in a label and a blank button sprite. The controls are customizable(Screenshot Below for what I mean) and whatever key is assigned shows up.

enter image description here

Now my worry is that when I store the gamepad control as string. It won't be stored as A, B, L for the different buttons but as (DualShock Cross, XBox A, Nintendo B) for a single button. Which is very lengthy. Now of course I can use an if
statement and change it.
Like
if event.as_text()=="DualShock Cross, XBox A, Nintendo B": InputScript.Attack_1 = "A"

But here the problem appears that these three controllers from different companies seem to be using the same 'signal' for very different inputs. Nintendo's B is Xbox A. So how do I differentiate?
So in this code from above
event.astext()=="DualShock Cross, XBox A, Nintendo B":
// Device checking code.
InputScript.Attack
1 = "A"

I now need to find a way to determine which device is being used.

So if Device is Xbox then InputScript.Attack_1 = "A"
and if Device is Nintendo InputScript.Attack_1 = "B"

So that's my last question how do I determine what kind of controller is being used?

Godot version 3.4.4
in Engine by (202 points)

1 Answer

+1 vote

Input.get_joy_name(int device)

by (650 points)
edited by

The method getjoyname() isn't declared in the current class. Is this not a built in method?

Wait do I need to use Input.

OK that seems to be working. I will do more testing.

Ok but I still need to know the Ids for the different joypads. Is there a list somewhere with device ID and name?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.