Game Development Community

Ideas about creating configurable keyboard and joystick input?

by Adam Johnston · in Torque Game Builder · 02/06/2006 (1:31 pm) · 5 replies

Hi T2D fellows!

I'm interested in adding the ability to reconfigure the keyboard-map
and the joystick-map, any advice about this?

Thanxs!
PD: I mean give the player the ability to redefine his buttons...

#1
02/07/2006 (10:03 am)
Remapping keys is stock functionality in TGE, and I'll check with the T2D team to see if it's been adjusted/not brought up to speed yet. It's possible/probable that the options gui simply wasn't brought along intact.
#2
02/07/2006 (10:35 am)
This made its first appearance in T2D with the new directory structure. So, any version post alpha3b should have it.

We expanded the functionality of TGE's keybindings slightly to make it easier to handle in T2D. All you need to do is create a file called defaultBind.cs in T2D/gameScripts.cs and perform all the bindings there. Also, you can pass an additional parameter to the bind command that is the name of the command. This name will show up in the options gui. So, defaultBind.cs would look something like this:

new ActionMap(moveMap);
moveMap.bind(keyboard, left, moveLeft, "Move Left");
moveMap.push();

T2D will take care of saving and reloading the configured binds automatically.
#3
02/07/2006 (11:07 am)
Yes I noticed this was part of T2D only problem I didn't know how to use.
I was able to put the joystick part (guess there is no stock support for this) and about
the keyboard I'm going to test Adam suggestion. Thank you.
#4
02/07/2006 (1:55 pm)
Just to make this more clear. Any keybinding that gets set during the execution of the loadKeybindings function in T2D/main.cs will be added to the options remap dialog. Right now you will notice it is execing defaultBind.cs in that function - which is why I reccommended just puting everything there.
#5
02/07/2006 (3:28 pm)
NOTE: I'm using alpha4

I noticed the spacescroller has loadKeybindings() in "spacescroller/main.cs"
that is want I want because my game has his own folder and I'd like to have all his
scripts in this folder. Is this aproach still valid or correct?