![]() |
KTech 1.1.0
C++ 2D terminal game engine library
|
Engine component responsible for registering all world structures. More...
#include <memory.hpp>
Public Member Functions | |
| void | CallOnTicks () |
Call the virtual OnTick() functions of all registered world structures. | |
Public Attributes | |
| CachingRegistry< Object > | objects |
Objects registry. | |
| CachingRegistry< Layer > | layers |
Layers registry. | |
| CachingRegistry< Camera > | cameras |
Cameras registry. | |
| CachingRegistry< Map > | maps |
Maps registry. | |
| CachingRegistry< Widget > | widgets |
Widgets registry. | |
| CachingRegistry< UI > | uis |
UIs registry. | |
Friends | |
| class | Output |
Engine component responsible for registering all world structures.
This engine component contains a CachingRegistry for each world structure. World structures automatically add themselves to their corresponding CachingRegistry here. This way world structures can refer and get access to each other in a serializable way, using their IDs (in contrary to a memory addresses, which aren't serializable nor safe in terms of memory). This is why world structures need an Engine reference (and is indeed a non-optional parameter in all of their constructors); they must have access to this place to integrate with everything else.
CachingRegistry to learn about accessing world structures using their ID. | void KTech::Memory::CallOnTicks | ( | ) |
Call the virtual OnTick() functions of all registered world structures.
Normally placed at the start of tick, with the other callback-calling functions of engine components. For example:
This function was placed in Memory, because this engine component has the most direct access to all of the world structures. Although, this function could have been technically placed easily anywhere else.