User Tools


AnnUserSpaceSubSystem

The AnnUserSpaceSubSystem is the intended base class for an engine SubSystem defined by the user.

This class is your interface to create your own subsystem. It's not abstract, so you could instantiate it by itself, but it would do absolutely nothing!

This class publically inherit from 2 base classes : AnnSubSystem and AnnUserSpaceEventLauncher, and provide you with 2 methods for you to override :

  • void update() : will be called by the engine at each frame if necessary.
  • bool needUpdate() : permit to signal to the engine that you nedd (or not) to be updated at the next frame. If you want to be called at each frame, make it return true.

The needUpdate method will allays be called by the engine, so you can put some housekeeping code (test change of state, get current timestamp…) to determinate if you want your update() to be called or not.

the “void dispatchEvent(std::shared_ptr<AnnUserSpaceEvent> e) final” protected method permit to dispatch to listeners an AnnUserSpaceEvent via the AnnEventManager from inside your class.

You need to provide a unique string “subsystem name” to the constructor. You can't have 2 subsystems living in the engine with the same name.

These can be defined directly in your code, or loaded as plugin Plugin