20,741
edits
Line 215: | Line 215: | ||
In addition to directly editing the default initialization routine in fg_init.cxx, you can also dynamically add/remove fgcommands from your SGSubsystem, by getting a handle to the SGCommandMgr singleton, specifying a command name, and a corresponding callback (which can be a static member of your SGSubsystem): | In addition to directly editing the default initialization routine in fg_init.cxx, you can also dynamically add/remove fgcommands from your SGSubsystem, by getting a handle to the SGCommandMgr singleton, specifying a command name, and a corresponding callback (which can be a static member of your SGSubsystem): | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
#include <simgear/structure/commands.hxx> | |||
... | |||
SGCommandMgr::instance()->addCommand("command-name", commandCallback); | SGCommandMgr::instance()->addCommand("command-name", commandCallback); | ||
</syntaxhighlight> | </syntaxhighlight> |