Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Second Virtual Joystick, PC

Author
Message
prinsallan
2
Years of Service
User Offline
Joined: 29th Jul 2021
Location:
Posted: 13th Oct 2021 10:10
Trying to code two player chess, but can't find the
commands for a Second Joystick anywhere in the documentation.
My first Joystic setup looks like this and works perfectly:



1) How do I let the computer know it is looking for 2 joysticks?
2) What are the commands for recognising a second Joystick?
3) Are there own commands for each seperate joystick or do I just call for (1) or (2)...?

Our first game will soon be up on Steam, if you want to check it out, it's called Cubes of Death and realease will be 18th of October 2021.

Best Regards
-Jonas, Mad Hat Games
TamBam
12
Years of Service
User Offline
Joined: 29th Nov 2011
Location: India
Posted: 13th Oct 2021 11:46 Edited at: 13th Oct 2021 12:09
That's Great news some one submitting game on steam. It will very helpful for community in near future . Anyways You looking for Virtual Joystick ? or Physical Joystick ?

If Physical Joysticks then use [ integer=GetRawJoystickExists ( id ) ] id is an integer value (1 to 4) giving the ID to be tested. ( means max 4 joysticks you can connect )
The function will return 1 if the specified ID has been assigned to a physical joystick,otherwise zero is returned.
hosch
Developer
2
Years of Service
User Offline
Joined: 25th May 2021
Location:
Posted: 13th Oct 2021 12:13 Edited at: 13th Oct 2021 12:16
So, you can create a second virtual joystick yourself by calling AddVirtualJoystick(index, x, y, size). Index must be in the range from 1-4. Later you can access this information by calling GetVirtualJoystickY(index) for example.



Something along those lines.
TamBam
12
Years of Service
User Offline
Joined: 29th Nov 2011
Location: India
Posted: 13th Oct 2021 12:15
I don't think he talking about virtual Joystick . I think he about to Physical joysticks may be his heading wrong .
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 16th Oct 2021 13:51 Edited at: 16th Oct 2021 14:04
prinsallan,

you're mixing the AppGameKit "Guaranteed" Joystick (which will look for a physical joystick and create a Virtual Joystick if none found and/or allow WASD (simulated) "joystick" controls if a physical keyboard is detected) with Virtual Joysticks . Note:
Quote: "Definition
float GetJoystickX() "

...isn't asking for a Joystick ID where it assumes the joystick. in short, there is no 2nd AppGameKit Joystick.

so, as hosch says, Virtual Joysticks and Virtual buttons are what you appear to be looking for (which uses Virtual Joystick IDs for reference/provide for multiple joystick controls). and, if you want to provide for physical joysticks, as well, you'll need to check for those manually, then create the virtual sticks/buttons as necessary.

aka, note the Input separate headers:

Joystick, Button

vs

Virtual Joystick, Virtual Button

then, the Input Raw Joysticks which are more-robust commands for physical joysticks (only).

Login to post a reply

Server time is: 2024-05-06 02:46:23
Your offset time is: 2024-05-06 02:46:23