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
11
namespace
ecs
12
{
13
struct
IComponent
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
Player
final :
IComponent
36
{
37
bool
is_cli
{};
38
// bool is_alive{};
39
};
40
struct
Health
final :
IComponent
41
{
42
float
current
;
43
float
max
;
44
};
45
struct
Pixel
final :
IComponent
46
{
47
};
48
struct
Rect
final :
IComponent
49
{
// TODO(bobis33): remove, only used for texture actually
50
float
pos_x
{},
pos_y
{};
51
int
size_x
{},
size_y
{};
52
};
53
struct
Scale
final :
IComponent
54
{
55
float
x
{},
y
{};
56
};
57
struct
Text
final :
IComponent
58
{
59
std::string
content
;
60
unsigned
int
font_size
;
61
};
62
struct
Texture
final :
IComponent
63
{
64
std::string
path
;
65
// float rect_pos_x{}, rect_pos_y{};
66
// int rect_size_x{}, rect_size_y{};
67
};
68
struct
Transform
final :
IComponent
69
{
70
float
x
{},
y
{};
71
float
rotation
{};
72
};
73
struct
Velocity
final :
IComponent
74
{
75
float
x
{},
y
{};
76
};
77
struct
Animation
final :
IComponent
78
{
79
int
current_frame
{};
80
int
total_frames
{};
81
float
frame_duration
{};
82
float
current_time
{};
83
int
frame_width
{};
84
int
frame_height
{};
85
int
frames_per_row
{};
86
};
87
struct
Projectile
final :
IComponent
88
{
89
enum
Type
90
{
91
BASIC
,
92
SUPERCHARGED
93
};
94
Type
type
;
95
float
damage
;
96
float
lifetime
;
97
float
current_lifetime
;
98
int
pierce_remaining
;
// number of enemies it can still pass through (>=1)
99
};
100
101
struct
BeamCharge
final :
IComponent
102
{
103
float
current_charge
;
104
float
max_charge
;
105
};
106
107
struct
LoadingAnimation
final :
IComponent
108
{
109
int
current_frame
;
110
int
total_frames
;
111
float
frame_duration
;
112
float
current_time
;
113
float
frame_width
;
114
float
frame_height
;
115
int
frames_per_row
;
116
};
117
118
struct
Enemy
final :
IComponent
119
{
120
float
health
;
121
float
max_health
;
122
float
damage
;
123
float
speed
;
124
float
last_shot_time
;
125
float
shoot_cooldown
;
126
};
127
128
struct
Explosion
final :
IComponent
129
{
130
int
current_frame
;
131
int
total_frames
;
132
float
frame_duration
;
133
float
current_time
;
134
float
frame_width
;
135
float
frame_height
;
136
int
frames_per_row
;
137
float
lifetime
;
138
float
current_lifetime
;
139
};
140
141
struct
Hitbox
final :
IComponent
142
{
143
float
radius
;
144
float
offsetX
= 0.0f;
145
float
offsetY
= 0.0f;
146
};
147
148
struct
KeyboardInput
final :
IComponent
149
{
150
bool
space_pressed
{};
151
bool
up_pressed
{};
152
bool
down_pressed
{};
153
bool
left_pressed
{};
154
bool
right_pressed
{};
155
};
156
157
struct
Floor
final :
IComponent
158
{
159
};
160
161
struct
Ceiling
final :
IComponent
162
{
163
};
164
165
struct
Scrolling
final :
IComponent
166
{
167
float
speed_x
;
// Negative to scroll left
168
float
original_width
;
// Unscaled texture width in pixels
169
float
original_height
;
// Unscaled texture height in pixels
170
bool
fit_width
;
// If true, scale X to fit window width
171
};
172
173
struct
Score
final :
IComponent
174
{
175
int
value
;
176
};
177
struct
Layer
final :
IComponent
178
{
179
int
layer
;
180
};
181
182
}
// namespace ecs
ecs
ecs::Animation
Definition
Component.hpp:78
ecs::Animation::frame_width
int frame_width
Definition
Component.hpp:83
ecs::Animation::frames_per_row
int frames_per_row
Definition
Component.hpp:85
ecs::Animation::total_frames
int total_frames
Definition
Component.hpp:80
ecs::Animation::frame_duration
float frame_duration
Definition
Component.hpp:81
ecs::Animation::current_frame
int current_frame
Definition
Component.hpp:79
ecs::Animation::current_time
float current_time
Definition
Component.hpp:82
ecs::Animation::frame_height
int frame_height
Definition
Component.hpp:84
ecs::Audio
Definition
Component.hpp:18
ecs::Audio::loop
bool loop
Definition
Component.hpp:21
ecs::Audio::play
bool play
Definition
Component.hpp:22
ecs::Audio::path
std::string path
Definition
Component.hpp:19
ecs::Audio::volume
float volume
Definition
Component.hpp:20
ecs::BeamCharge
Definition
Component.hpp:102
ecs::BeamCharge::max_charge
float max_charge
Definition
Component.hpp:104
ecs::BeamCharge::current_charge
float current_charge
Definition
Component.hpp:103
ecs::Ceiling
Definition
Component.hpp:162
ecs::Color
Definition
Component.hpp:25
ecs::Color::a
unsigned char a
Definition
Component.hpp:29
ecs::Color::r
unsigned char r
Definition
Component.hpp:26
ecs::Color::g
unsigned char g
Definition
Component.hpp:27
ecs::Color::b
unsigned char b
Definition
Component.hpp:28
ecs::Enemy
Definition
Component.hpp:119
ecs::Enemy::health
float health
Definition
Component.hpp:120
ecs::Enemy::shoot_cooldown
float shoot_cooldown
Definition
Component.hpp:125
ecs::Enemy::speed
float speed
Definition
Component.hpp:123
ecs::Enemy::max_health
float max_health
Definition
Component.hpp:121
ecs::Enemy::last_shot_time
float last_shot_time
Definition
Component.hpp:124
ecs::Enemy::damage
float damage
Definition
Component.hpp:122
ecs::Explosion
Definition
Component.hpp:129
ecs::Explosion::current_lifetime
float current_lifetime
Definition
Component.hpp:138
ecs::Explosion::frame_height
float frame_height
Definition
Component.hpp:135
ecs::Explosion::lifetime
float lifetime
Definition
Component.hpp:137
ecs::Explosion::current_frame
int current_frame
Definition
Component.hpp:130
ecs::Explosion::frame_width
float frame_width
Definition
Component.hpp:134
ecs::Explosion::frames_per_row
int frames_per_row
Definition
Component.hpp:136
ecs::Explosion::current_time
float current_time
Definition
Component.hpp:133
ecs::Explosion::total_frames
int total_frames
Definition
Component.hpp:131
ecs::Explosion::frame_duration
float frame_duration
Definition
Component.hpp:132
ecs::Floor
Definition
Component.hpp:158
ecs::Font
Definition
Component.hpp:32
ecs::Font::path
std::string path
Definition
Component.hpp:33
ecs::Health
Definition
Component.hpp:41
ecs::Health::current
float current
Definition
Component.hpp:42
ecs::Health::max
float max
Definition
Component.hpp:43
ecs::Hitbox
Definition
Component.hpp:142
ecs::Hitbox::offsetY
float offsetY
Definition
Component.hpp:145
ecs::Hitbox::offsetX
float offsetX
Definition
Component.hpp:144
ecs::Hitbox::radius
float radius
Definition
Component.hpp:143
ecs::IComponent
Definition
Component.hpp:14
ecs::IComponent::id
std::string id
Definition
Component.hpp:15
ecs::KeyboardInput
Definition
Component.hpp:149
ecs::KeyboardInput::right_pressed
bool right_pressed
Definition
Component.hpp:154
ecs::KeyboardInput::down_pressed
bool down_pressed
Definition
Component.hpp:152
ecs::KeyboardInput::left_pressed
bool left_pressed
Definition
Component.hpp:153
ecs::KeyboardInput::space_pressed
bool space_pressed
Definition
Component.hpp:150
ecs::KeyboardInput::up_pressed
bool up_pressed
Definition
Component.hpp:151
ecs::Layer
Definition
Component.hpp:178
ecs::Layer::layer
int layer
Definition
Component.hpp:179
ecs::LoadingAnimation
Definition
Component.hpp:108
ecs::LoadingAnimation::frame_height
float frame_height
Definition
Component.hpp:114
ecs::LoadingAnimation::frame_width
float frame_width
Definition
Component.hpp:113
ecs::LoadingAnimation::current_time
float current_time
Definition
Component.hpp:112
ecs::LoadingAnimation::total_frames
int total_frames
Definition
Component.hpp:110
ecs::LoadingAnimation::current_frame
int current_frame
Definition
Component.hpp:109
ecs::LoadingAnimation::frames_per_row
int frames_per_row
Definition
Component.hpp:115
ecs::LoadingAnimation::frame_duration
float frame_duration
Definition
Component.hpp:111
ecs::Pixel
Definition
Component.hpp:46
ecs::Player
Definition
Component.hpp:36
ecs::Player::is_cli
bool is_cli
Definition
Component.hpp:37
ecs::Projectile
Definition
Component.hpp:88
ecs::Projectile::pierce_remaining
int pierce_remaining
Definition
Component.hpp:98
ecs::Projectile::lifetime
float lifetime
Definition
Component.hpp:96
ecs::Projectile::type
Type type
Definition
Component.hpp:94
ecs::Projectile::current_lifetime
float current_lifetime
Definition
Component.hpp:97
ecs::Projectile::Type
Type
Definition
Component.hpp:90
ecs::Projectile::SUPERCHARGED
@ SUPERCHARGED
Definition
Component.hpp:92
ecs::Projectile::BASIC
@ BASIC
Definition
Component.hpp:91
ecs::Projectile::damage
float damage
Definition
Component.hpp:95
ecs::Rect
Definition
Component.hpp:49
ecs::Rect::pos_y
float pos_y
Definition
Component.hpp:50
ecs::Rect::size_y
int size_y
Definition
Component.hpp:51
ecs::Rect::size_x
int size_x
Definition
Component.hpp:51
ecs::Rect::pos_x
float pos_x
Definition
Component.hpp:50
ecs::Scale
Definition
Component.hpp:54
ecs::Scale::x
float x
Definition
Component.hpp:55
ecs::Scale::y
float y
Definition
Component.hpp:55
ecs::Score
Definition
Component.hpp:174
ecs::Score::value
int value
Definition
Component.hpp:175
ecs::Scrolling
Definition
Component.hpp:166
ecs::Scrolling::original_height
float original_height
Definition
Component.hpp:169
ecs::Scrolling::speed_x
float speed_x
Definition
Component.hpp:167
ecs::Scrolling::original_width
float original_width
Definition
Component.hpp:168
ecs::Scrolling::fit_width
bool fit_width
Definition
Component.hpp:170
ecs::Text
Definition
Component.hpp:58
ecs::Text::font_size
unsigned int font_size
Definition
Component.hpp:60
ecs::Text::content
std::string content
Definition
Component.hpp:59
ecs::Texture
Definition
Component.hpp:63
ecs::Texture::path
std::string path
Definition
Component.hpp:64
ecs::Transform
Definition
Component.hpp:69
ecs::Transform::x
float x
Definition
Component.hpp:70
ecs::Transform::y
float y
Definition
Component.hpp:70
ecs::Transform::rotation
float rotation
Definition
Component.hpp:71
ecs::Velocity
Definition
Component.hpp:74
ecs::Velocity::x
float x
Definition
Component.hpp:75
ecs::Velocity::y
float y
Definition
Component.hpp:75
modules
ECS
include
ECS
Component.hpp
Generated by
1.11.0