Yume Project 3.0
Touhou-inspired Danmaku game made in C only
Chargement...
Recherche...
Aucune correspondance
common.h
Aller à la documentation de ce fichier.
1
12
13#pragma once
14
15#include "ecs/component.h"
16#include "ecs/ecs.h"
17#include <raylib.h>
18#include <stdbool.h>
19#include <stdint.h>
20
21#define BOUNDS_X 100
22#define BOUNDS_Y 50
23
24typedef struct Pool Pool;
25
26// ------------ component tag ------------
42
43// ------------ component position ------------
44typedef struct Position {
45 Vector2 pos;
46 float angle;
48
49typedef EntityType Tag;
50
51typedef struct {
52 uint32_t unique_id;
53} Uid;
54
55
59
60
61// ------------ component owner ------------
62typedef Entity Owner;
63
64//Note: Pour avoir un owner, il faut que celui-ci ait une position et que l'entitée possédée ait une position (dans l'ECS);
66
68
79
87extern void Position_set_position(Position * pos, float x, float y);
88
98extern Entity Position_create(Pool *p, float x, float y, float angle);
99
100
108extern void Owner_bind(Pool *p, Entity PositionId, Entity ParticleId);
109
116bool Tag_in_array(Tag tag, Tag * array, int size);
Entity Position_create(Pool *p, float x, float y, float angle)
Crée une entité avec une position.
void Owner_bind(Pool *p, Entity PositionId, Entity ParticleId)
Ajoute un owner à une entité
bool Tag_in_array(Tag tag, Tag *array, int size)
Entity Owner
Definition common.h:62
void Owner_update(Pool *p)
Met à jour la position de toutes les entitées qui ont un owner en copiant celle de leur owner.
EntityType Tag
Definition common.h:40
EntityType
Definition common.h:27
@ ENT_ENEMY_LASER
Definition common.h:34
@ ENT_PARTICLE
Definition common.h:37
@ ENT_LOOSE_LASER
Definition common.h:36
@ ENT_BOSS
Definition common.h:31
@ ENT_BACKGROUND
Definition common.h:38
@ ENT_ENEMY_SHOT
Definition common.h:32
@ ID_INVALID
Definition common.h:28
@ ENT_ENEMY
Definition common.h:30
@ ENT_PLAYER
Definition common.h:29
@ ENT_PLAYER_SHOT
Definition common.h:33
@ ENT_PLAYER_LASER
Definition common.h:35
void Position_set_position(Position *pos, float x, float y)
Met une valeur de position.
bool Position_is_out_of_bounds(Position *pos)
Renvoie si la position est dans le cadre du jeu.
Macros nécessaire à la création de nouvelles composantes de l'ECS.
#define DEFINE_COMPONENT_MANAGER(Type, Number)
Créé un composant dans l'ECS.
Definition component.h:62
#define DECLARE_SETTER_GETTER(Component, type, champ)
Definition component.h:121
Types et déclarations utilisés dans l'ECS.
#define MAX_ENTITIES
Definition ecs.h:14
uint32_t Entity
Une entité est un indice.
Definition ecs.h:20
La pool est la structure qui contient l'Entity Component System Elle gêre les différentes composantes...
Definition pool.h:42
Definition common.h:44
float angle
Definition common.h:46
Vector2 pos
Definition common.h:45
Definition common.h:51
uint32_t unique_id
Definition common.h:52