feat: allow game registering of components
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#ifndef LIGHTKEEPER_GAMECOMPONENTLIST_H
|
||||
#define LIGHTKEEPER_GAMECOMPONENTLIST_H
|
||||
|
||||
#include <components/PrintComponent.h>
|
||||
|
||||
#define LIGHTKEEPER_GAME_COMPONENTS(X) \
|
||||
X(PrintComponent)
|
||||
|
||||
#endif // LIGHTKEEPER_GAMECOMPONENTLIST_H
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef LIGHTKEEPER_GAMECOMPONENTREGISTRY_H
|
||||
#define LIGHTKEEPER_GAMECOMPONENTREGISTRY_H
|
||||
|
||||
void RegisterGameComponents();
|
||||
|
||||
#endif // LIGHTKEEPER_GAMECOMPONENTREGISTRY_H
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef DESTRUM_PRINTCOMPONENT_H
|
||||
#define DESTRUM_PRINTCOMPONENT_H
|
||||
#include "destrum/ObjectModel/Component.h"
|
||||
|
||||
class PrintComponent: public Component {
|
||||
public:
|
||||
|
||||
PrintComponent(GameObject& parent);
|
||||
|
||||
std::string GetTypeName() const override { return "PrintComponent"; }
|
||||
void Start() override;
|
||||
void Update(float dt) override;
|
||||
void ImGuiInspector() override;
|
||||
nlohmann::json Serialize() const override;
|
||||
void Deserialize(const nlohmann::json&) override;
|
||||
|
||||
void SetMessage(std::string_view message)
|
||||
{
|
||||
m_message = message;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string m_message{};
|
||||
|
||||
};
|
||||
|
||||
#endif //DESTRUM_PRINTCOMPONENT_H
|
||||
Reference in New Issue
Block a user