Documentation: Generalised the subsystem example.
This commit is contained in:
parent
7a6e63ddb9
commit
a9e0ec843b
1 changed files with 5 additions and 5 deletions
|
@ -51,11 +51,11 @@ Subsystems
|
||||||
To add a new subsystem you would have to create a derived class from
|
To add a new subsystem you would have to create a derived class from
|
||||||
SGSubsystem and define at least a small set of functions:
|
SGSubsystem and define at least a small set of functions:
|
||||||
|
|
||||||
class FGFX : public SGSubsystem
|
class FGSubsystemExample : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGFX();
|
FGSubsystemExample();
|
||||||
virtual ~FGFX();
|
virtual ~FGSubsystemExample();
|
||||||
|
|
||||||
// Subsystem API.
|
// Subsystem API.
|
||||||
void bind() override;
|
void bind() override;
|
||||||
|
@ -65,7 +65,7 @@ SGSubsystem and define at least a small set of functions:
|
||||||
void update(double dt) override;
|
void update(double dt) override;
|
||||||
|
|
||||||
// Subsystem identification.
|
// Subsystem identification.
|
||||||
static const char* subsystemName() { return "fx"; }
|
static const char* subsystemName() { return "subsystem-example"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
The init() functions should make sure everything is set and ready so the
|
The init() functions should make sure everything is set and ready so the
|
||||||
|
@ -76,7 +76,7 @@ The bind() and unbind() functions can be used to tie and untie properties.
|
||||||
|
|
||||||
After that you can register this class at the subsystem manager:
|
After that you can register this class at the subsystem manager:
|
||||||
|
|
||||||
globals->add_subsystem("fx", new FGFX);
|
globals->add_subsystem("example", new FGSubsystemExample);
|
||||||
|
|
||||||
Now the subsystem manager calls the update() function of this class every
|
Now the subsystem manager calls the update() function of this class every
|
||||||
frame. dt is the time (in seconds) elapsed since the last call.
|
frame. dt is the time (in seconds) elapsed since the last call.
|
||||||
|
|
Loading…
Reference in a new issue