]> git.tdb.fi Git - libs/game.git/blobdiff - source/game/meshsource.h
Add components for giving entities a visual appearance
[libs/game.git] / source / game / meshsource.h
diff --git a/source/game/meshsource.h b/source/game/meshsource.h
new file mode 100644 (file)
index 0000000..74ec781
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef MSP_GAME_MESHSOURCE_H_
+#define MSP_GAME_MESHSOURCE_H_
+
+#include <msp/datafile/objectloader.h>
+#include "component.h"
+
+namespace Msp::Game {
+
+struct MeshSourceSetup
+{
+       class Loader: public DataFile::ObjectLoader<MeshSourceSetup>
+       {
+       private:
+               static Loader::ActionMap shared_actions;
+
+       public:
+               Loader(MeshSourceSetup &);
+
+       protected:
+               void init_actions() override;
+       };
+
+       std::string object_name;
+};
+
+class MeshSource: public Component
+{
+public:
+       using Setup = MeshSourceSetup;
+
+private:
+       const Setup &setup;
+
+public:
+       MeshSource(Handle<Entity> e, const Setup &s): Component(e), setup(s) { }
+
+       const std::string &get_object_name() const { return setup.object_name; }
+};
+
+} // namespace Msp::Game
+
+#endif