|
Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
|
Base class for components that need async setup during boot. More...
#include <SetupComponent.h>
Inherits DekiBehaviour.
Public Types | |
| using | SetupCallback = std::function<void(bool success)> |
| using | EditorAutoFactory = SetupComponent* (*)() |
Public Member Functions | |
| SetupComponent ()=default | |
| virtual | ~SetupComponent ()=default |
| virtual void | Setup (SetupCallback onComplete)=0 |
| Begin async setup. | |
| virtual const char * | GetSetupName () const =0 |
| Get display name for logging. | |
| Public Member Functions inherited from DekiBehaviour | |
| DekiBehaviour () | |
| virtual | ~DekiBehaviour ()=default |
| ComponentType | GetType () const override |
| ComponentType | GetBaseType () const override |
| DekiBehaviour * | AsBehaviour () override |
| virtual void | Awake () |
| Called once after AssetRefs and ObjectRefs are resolved. | |
| virtual void | Start () |
| Called once before first Update, after ALL Awake calls complete. | |
| virtual void | Update () |
| Called every frame (only if needs_update is true). | |
| bool | HasAwoken () const |
| bool | HasStarted () const |
| void | MarkAwoken () |
| void | MarkStarted () |
| virtual bool | NeedsUpdate () const |
| Runtime opt-out for Update() calls. | |
| void | SetNeedsUpdate (bool needs) |
| Enable or disable per-frame Update() calls. | |
| Public Member Functions inherited from DekiComponent | |
| DekiComponent () | |
| virtual | ~DekiComponent ()=default |
| DekiComponent (const DekiComponent &)=delete | |
| DekiComponent & | operator= (const DekiComponent &)=delete |
| virtual bool | DeclaresUpdate () const |
| Does this class (or a reflected base) declare Update()? | |
| DekiObject * | GetOwner () const |
| void | SetOwner (DekiObject *owner) |
| virtual void | LoadAssets () |
| Load assets needed by this component. | |
| virtual void | UnloadAssets () |
| Unload/clear assets held by this component. | |
| virtual void | RuntimeUpdate (float deltaTime) |
| Update this component (runtime only). | |
| virtual void | OnAssetRefResolved (const char *propertyName, void *asset, const char *guid) |
| Called after an AssetRef property is resolved by LifecycleManager. | |
| virtual bool | NeedsAssetLoading () const |
| Check if this component needs asset loading. | |
| virtual bool | NeedsRuntimeUpdate () const |
| Check if this component needs runtime updates. | |
| virtual bool | Deserialize (SceneFormat::SceneMsgPackParser &parser, uint32_t mapSize) |
| Deserialize component data from MessagePack. | |
| virtual void | ResolveObjectRefs (class Scene *scene) |
| Resolve all ObjectRef properties in this component. | |
| virtual void | RemapObjectRefs (const std::unordered_map< uint32_t, uint32_t > &idRemap) |
| Remap ObjectRef IDs after cloning/instantiation. | |
| bool | HasRefsResolved () const |
| void | MarkRefsResolved () |
| void | ResetRefsResolved () |
| virtual void | OnPropertyChanged (const char *propertyName) |
| Called when a property is modified via the editor. | |
Static Public Member Functions | |
| static SETUP_COMPONENT_API void | RegisterEditorAutoFactory (EditorAutoFactory factory) |
| static SETUP_COMPONENT_API void | ClearEditorAutoFactories () |
| static SETUP_COMPONENT_API void | RunEditorAutoSetups () |
Additional Inherited Members | |
| Static Public Attributes inherited from DekiBehaviour | |
| static constexpr ComponentType | StaticType = DekiHashString("DekiBehaviour") |
| Static Public Attributes inherited from DekiComponent | |
| static constexpr ComponentType | StaticType = 0 |
| Protected Attributes inherited from DekiComponent | |
| DekiObject * | m_Owner |
| bool | m_RefsResolved |
Base class for components that need async setup during boot.
Similar pattern to RendererComponent - inherit from this to participate in the boot sequence. BootSequenceComponent uses ObjectRef<SetupComponent> to reference setup components.
Usage: class MyHardwareComponent : public SetupComponent { DEKI_COMPONENT(MyHardwareComponent, SetupComponent, "System", "your-guid-here", "DEKI_FEATURE_MY_HARDWARE")
void Setup(SetupCallback onComplete) override { bool success = InitializeHardware(); onComplete(success); }
const char* GetSetupName() const override { return "My Hardware"; } };
| using SetupComponent::SetupCallback = std::function<void(bool success)> |
| using SetupComponent::EditorAutoFactory = SetupComponent* (*)() |
|
default |
|
virtualdefault |
|
pure virtual |
Begin async setup.
Call callback when done.
Implementations should perform their initialization and then call the callback with true on success, false on failure.
| onComplete | Callback to invoke when setup finishes |
|
pure virtual |
Get display name for logging.
|
static |
|
static |
|
static |