]> git.tdb.fi Git - libs/game.git/blob - source/game/meshsource.h
Add components for giving entities a visual appearance
[libs/game.git] / source / game / meshsource.h
1 #ifndef MSP_GAME_MESHSOURCE_H_
2 #define MSP_GAME_MESHSOURCE_H_
3
4 #include <msp/datafile/objectloader.h>
5 #include "component.h"
6
7 namespace Msp::Game {
8
9 struct MeshSourceSetup
10 {
11         class Loader: public DataFile::ObjectLoader<MeshSourceSetup>
12         {
13         private:
14                 static Loader::ActionMap shared_actions;
15
16         public:
17                 Loader(MeshSourceSetup &);
18
19         protected:
20                 void init_actions() override;
21         };
22
23         std::string object_name;
24 };
25
26 class MeshSource: public Component
27 {
28 public:
29         using Setup = MeshSourceSetup;
30
31 private:
32         const Setup &setup;
33
34 public:
35         MeshSource(Handle<Entity> e, const Setup &s): Component(e), setup(s) { }
36
37         const std::string &get_object_name() const { return setup.object_name; }
38 };
39
40 } // namespace Msp::Game
41
42 #endif