Game Development Community

Need Help: How to update and re-compile the Tool (TORQUE_PLAYER & Key Bindings)

by Mark Grossnickle · in iTorque 2D · 02/19/2011 (2:12 am) · 4 replies

I am trying to add a key binding for 'cmd p' to playGame() similar to how F5 is setup. The main location for default key bindings seems to be tgb/tools/main.cs. However, any changes I make to main.cs do not seem to get picked up when I compile the engine.

1. I cleared the dso files and still no luck... in fact, no new dso files appeared when i rebuilt the engine.

2. I tried adding TORQUE_PLAYER macro and rebuilt the engine. It created new dso files, but man is everything jacked... You can't see the initial splash screen, the mouse keeps making copies of itself like a trail effect, and loading projects fail.

3. I then removed the TORQUE_PLAYER macro and rebuilt the engine. It at least got me back to where I started and I can get into the tool and open projects again; however, it did not pick up the key binding changes I made to the tool.


How do I compile the tools folder and update my key bindings?


Thanks

#1
02/19/2011 (6:25 am)
The tools folder doesn't compile to the same location the .cs files are. Everything it compiles goes into ~/Library/Application Support/<whatever the company dir is called now>/<project name, probably Torque Game builder>/.

I'm pretty sure TORQUE_PLAYER means "don't build editor code", which would mess things up a bit. I also think the code isn't very flexible when it comes to qualifier keys, so cmd might be tricky. Especially if cmd-p is already bound to paste. I think some manual keybinds set that in some file in the hierarchy.

Try making it shift-p or something.
#2
02/19/2011 (1:01 pm)
Thanks Ronny. Not sure I completely follow though.

1. Tools Folder Doesn't Compile to same location... But if that is true, then why did it compile to the tools folder when I added the TORQUE_PLAYER macro? And when I don't use that macro, if they are still getting compiled, how do I get the changes to show up in TGB?

2. I chose TORQUE_PLAYER because of the following code in torqueConfig.h:

#ifndef TORQUE_PLAYER
# define TORQUE_TOOLS
#else
# undef TORQUE_TOOLS
#endif

If I just use TORQUE_TOOLS I get hundreds of warnings from the TORQUE_TOOLS getting redefined. Is there another macro I should be using? Or potentionally a combination of macros?

3. I just used cmd p as an example... albeit a poorly thought out one. Currently TBG has 'p' bound to showing the projects tab. I changed it to 'l', just for testing. Theoretically, even if 'l' doesn't get bound or gets overridden, 'p' should no longer open the projects tab... yet it still does so I believe my code is not getting compiled into TGB.


Still not sure on how to get this change going, but thanks for the feedback thus far.
#3
02/19/2011 (2:44 pm)
1. Because TORQUE_PLAYER = the game. To play the files. Different settings. It's not just a little macro; it's a pretty major compilation flag. With it set, none of the editor-specific bits are compiled in, and script compilation behaviour is different.

2.Search for both flags. They are probably used in different ways in many parts of the code, not always interlinked like that :)

I tried adding this to tgb/tools/main.cs:
levelEditorMap.bindCmd(keyboard, "g", "runGame();", "");

Worked for me, so if it's not working for you try clearing the TorquePowered/GarageGames folders from ~/Library/Application Support/. In practice scripts don't even need to be compiled - you can run with just uncompiled script even on the device. DSOs will be picked up first if available, so clearing them out should help.
#4
02/20/2011 (1:47 am)
Ronny, thanks for the help! It was a file called customEditorBinds.cs within "~/Library/Application Support/". I deleted that and now it loads the new binds.

You were right about it always loading tools/main.cs. I noticed in the logs that it was always getting executed. I then added some echo's and found it was returning before the binds during this code block:

loadCustomEditorbindings();

if (isObject(levelEditorMap))
return;

Thus, it was finding custom binds and returned before it got to my changes. I had no clue there was a mac folder for ~Library/Application Support/, you are a life saver for leading away from my crazy notions of macros and who knows what else... ;)

Cheers!