Find current key binds C++?
by Tim Hutcheson · in Torque Game Engine · 06/15/2005 (12:37 pm) · 2 replies
Is there a simple way to discover the current key bindings from a C++ method?
I want to populate an array of key and associated console method strings, like {'w',"moveforward"},... at runtime to be sure that the running scripts are using same console methods that I assume. Otherwise there is the possibllity that 'w' key might be bound to "acclerate" of something else, for example
I want to populate an array of key and associated console method strings, like {'w',"moveforward"},... at runtime to be sure that the running scripts are using same console methods that I assume. Otherwise there is the possibllity that 'w' key might be bound to "acclerate" of something else, for example
About the author
#2
06/15/2005 (1:41 pm)
Thanks for the headsup Mark. I executed the following code just before I need the bindings and indeed it has spit them to the console. Thanks.SimSet* pActionMapSet = Sim::getActiveActionMapSet();
AssertFatal(pActionMapSet && pActionMapSet->size() != 0,
"error, no ActiveMapSet or no global action map...");
for (SimSet::iterator itr = pActionMapSet->end() - 1;
itr > pActionMapSet->begin(); itr--) {
ActionMap* pMap = static_cast<ActionMap*>(*itr);
pMap->dumpActionMap(NULL, false);
}
Torque Owner Mark Storer
www.garagegames.com/docs/tge/engine/classActionMap.php#a2
void ActionMap::dumpActionMap ( const char * fileName, const bool append ) const
So you could parse the file to build your array, or you could make a similar ActionMap::dumpToConsoleArrayThingy() function.