Howto:Optimizing FlightGear for mobile devices: Difference between revisions

Jump to navigation Jump to search
Line 208: Line 208:
class SGOptional : public SGPropertyChangeListener {
class SGOptional : public SGPropertyChangeListener {
public:
public:
  SGOptional(const SGPropertyNode_ptr& switch_node, const T* ptr): _type(ptr);
  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", new SGSoundMgr), SGSubsystemMgr::SOUND);
     globals->add_subsystem("sound", new SGOptional<SGSoundMgr>("/enable/sound"), SGSubsystemMgr::SOUND);
</syntaxhighlight>
</syntaxhighlight>


Navigation menu