Euphoria
game.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "io/json.h"
4 
5 
6 namespace eu::files::game
7 {
9 
10  struct vec2f
11  {
12  float x;
13  float y;
14  };
15 
16  struct Sprite
17  {
18  std::string path;
19  };
20 
21  struct VarNumber
22  {
23  float value;
24  };
25 
26  struct Var
27  {
28  std::string name;
29 
30  // only one is valid
31  std::optional<VarNumber> number;
32  };
33 
34  struct Custom
35  {
36  std::string name;
37  std::vector<Var> arguments;
38  };
39 
40  struct Component
41  {
42  // only one is valid
43  std::optional<vec2f> position;
44  std::optional<Sprite> sprite;
45  std::optional<Custom> custom;
46  };
47 
48  struct Template
49  {
50  std::string name;
51  std::vector<Component> components;
52  };
53 
54  // todo(Gustav): rename enum
55  enum class ViewportType
56  {
58  };
59 
60  struct Viewport
61  {
63  float width = 1.0f;
64  float height = 1.0f;
65  };
66 
68 
69  struct KeyBind
70  {
71  std::string name;
72  std::string key;
73  };
74 
76 
77  struct Color
78  {
79  // todo(Gustav): change to a rgb property
80  std::optional<std::string> hex;
81  };
82 
83  struct Game
84  {
85  std::string title;
86  std::optional<Color> clear_color;
88  std::vector<KeyBind> binds;
89  std::vector<Template> templates;
90  };
91 
93 }
JSON_PARSE_FUNC(vec2f)
Definition: game.cc:6
std::optional< std::string > hex
Definition: game.h:80
std::optional< vec2f > position
Definition: game.h:43
std::optional< Sprite > sprite
Definition: game.h:44
std::optional< Custom > custom
Definition: game.h:45
std::vector< Var > arguments
Definition: game.h:37
std::string name
Definition: game.h:36
Viewport viewport
Definition: game.h:87
std::vector< Template > templates
Definition: game.h:89
std::vector< KeyBind > binds
Definition: game.h:88
std::string title
Definition: game.h:85
std::optional< Color > clear_color
Definition: game.h:86
std::string key
Definition: game.h:72
std::string name
Definition: game.h:71
std::string path
Definition: game.h:18
std::vector< Component > components
Definition: game.h:51
std::string name
Definition: game.h:50
std::optional< VarNumber > number
Definition: game.h:31
std::string name
Definition: game.h:28
ViewportType type
Definition: game.h:62