r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
Component.hpp
Go to the documentation of this file.
1///
2/// @file Component.hpp
3/// @brief This file contains the component definitions
4/// @namespace ecs
5///
6
7#pragma once
8
9#include <string>
10
11namespace ecs
12{
14 {
15 std::string id;
16 };
17 struct Audio final : IComponent
18 {
19 std::string path;
20 float volume;
21 bool loop;
22 bool play;
23 };
24 struct Color final : IComponent
25 {
26 unsigned char r{};
27 unsigned char g{};
28 unsigned char b{};
29 unsigned char a{};
30 };
31 struct Font final : IComponent
32 {
33 std::string path;
34 };
35 struct Mob final : IComponent
36 {
37 // bool is_alive{};
38 };
39 struct Player final : IComponent
40 {
41 bool is_cli{};
42 // bool is_alive{};
43 };
44 struct Pixel final : IComponent
45 {
46 };
47 struct Rect final : IComponent
48 { // TODO(bobis33): remove, only used for texture actually
49 float pos_x{}, pos_y{};
50 int size_x{}, size_y{};
51 };
52 struct Scale final : IComponent
53 {
54 float x{}, y{};
55 };
56 struct Text final : IComponent
57 {
58 std::string content;
59 unsigned int font_size;
60 };
61 struct Texture final : IComponent
62 {
63 std::string path;
64 // float rect_pos_x{}, rect_pos_y{};
65 // int rect_size_x{}, rect_size_y{};
66 };
67 struct Transform final : IComponent
68 {
69 float x{}, y{};
70 float rotation{};
71 };
72 struct Velocity final : IComponent
73 {
74 float x{}, y{};
75 };
76 struct Animation final : IComponent
77 {
81 float current_time{};
85 };
86 struct Projectile final : IComponent
87 {
88 enum Type
89 {
92 };
94 float damage;
95 float lifetime;
97 };
98
99 struct BeamCharge final : IComponent
100 {
103 };
104
115
116 struct Enemy final : IComponent
117 {
118 float health;
120 float damage;
121 float speed;
124 };
125
126 struct Asteroid final : IComponent
127 {
128 enum Size
129 {
132 LARGE
133 };
136 float health;
137 };
138
151
152 struct Hitbox final : IComponent
153 {
154 float radius;
155 };
156
157} // namespace ecs
float frame_duration
Definition Component.hpp:80
float rotation_speed
std::string path
Definition Component.hpp:19
float volume
Definition Component.hpp:20
unsigned char a
Definition Component.hpp:29
unsigned char r
Definition Component.hpp:26
unsigned char g
Definition Component.hpp:27
unsigned char b
Definition Component.hpp:28
float shoot_cooldown
float max_health
float last_shot_time
float current_lifetime
std::string path
Definition Component.hpp:33
std::string id
Definition Component.hpp:15
float current_lifetime
Definition Component.hpp:96
float pos_y
Definition Component.hpp:49
float pos_x
Definition Component.hpp:49
unsigned int font_size
Definition Component.hpp:59
std::string content
Definition Component.hpp:58
std::string path
Definition Component.hpp:63