|
Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
|
Simple component factory using a single hash map. More...
Classes | |
| class | SceneFormat::ComponentFactory |
| Creates components by type id (see the file comment above). More... | |
Namespaces | |
| namespace | SceneFormat |
Macros | |
| #define | COMPONENT_FACTORY_API |
| #define | REGISTER_RUNTIME_COMPONENT(ClassName) |
| Register a component type for runtime creation. | |
Typedefs | |
| using | SceneFormat::ComponentCreator = DekiComponent* (*)() |
| Function pointer type for component creators. | |
Simple component factory using a single hash map.
All components (engine and plugins) register into one hash map. Engine components auto-register via generated code. Plugin/game components register at startup using REGISTER_RUNTIME_COMPONENT.
Usage: // Register a component (plugins/games do this at startup) REGISTER_RUNTIME_COMPONENT(MyComponent);
// Create any component by type ID auto* comp = ComponentFactory::Instance().Create(DekiHashString("MyComponent"));
| #define COMPONENT_FACTORY_API |
| #define REGISTER_RUNTIME_COMPONENT | ( | ClassName | ) |
Register a component type for runtime creation.
Uses static initialization to register the component. Engine components use this in package-specific registration files (e.g. 2DRegistration.gen.cpp). Plugins/games use this at startup for their components.