Engine
Raylib based game framework
Loading...
Searching...
No Matches
src
Engine
Components.h
1
#pragma once
2
3
#include "MyMath/MyVectors.h"
4
#include "raylib.h"
5
6
#include "Types.h"
7
8
namespace
Component
9
{
10
struct
Transform
11
{
12
Vector2f position;
13
Vector2f velocity;
14
float
rotation = 0;
15
};
16
17
struct
Sprite
18
{
19
Texture2D texture;
20
Rectangle rectangle = {0, 0, 0, 0};
21
Color color = WHITE;
22
float
scale = 1;
23
u32 layer = 1;
24
// When editing the texture or layer value
25
// registry.replace<Component::Sprite>(entity, sprite);
26
// with the updated reference for the sprites to be reordered correctly
27
// Do not create a owning entt group (registry.group<Component::Sprite>(....))
28
// as this will reorder the sprites
29
};
30
31
struct
Animation
32
{
33
bool
active =
false
;
34
u32 startingIndex = 0;
35
u32 endingIndex = 1;
36
u32 currentIndex = 0;
37
float
frameLengthS = 1;
38
float
frameAccumulator = 0;
39
};
40
}
Component::Animation
Definition
Components.h:32
Component::Sprite
Definition
Components.h:18
Component::Transform
Definition
Components.h:11
Generated by
1.9.8