20,741
edits
Line 208: | Line 208: | ||
class SGOptional : public SGPropertyChangeListener { | class SGOptional : public SGPropertyChangeListener { | ||
public: | public: | ||
SGOptional(const | SGOptional(const char* p) : _toggle_switch(p) { | ||
fgAddChangeListener(p, this); | |||
} | |||
void valueChanged() { | |||
// enable/disable system, call notification callbacks, set properties and allocate/free memory | |||
} | |||
protected: | protected: | ||
private: | private: | ||
SGPropertyNode_ptr _toggle_switch; | |||
T _type; | T _type; | ||
}; | }; | ||
Line 266: | Line 274: | ||
// Sound manager is updated last so it can use the CPU while the GPU | // Sound manager is updated last so it can use the CPU while the GPU | ||
// is processing the scenery (doubled the frame-rate for me) -EMH- | // is processing the scenery (doubled the frame-rate for me) -EMH- | ||
globals->add_subsystem("sound", new SGOptional<SGSoundMgr>("/enable/sound" | globals->add_subsystem("sound", new SGOptional<SGSoundMgr>("/enable/sound"), SGSubsystemMgr::SOUND); | ||
</syntaxhighlight> | </syntaxhighlight> | ||