Yume Project 3.0
Touhou-inspired Danmaku game made in C only
Chargement...
Recherche...
Aucune correspondance
physics.h
Aller à la documentation de ce fichier.
1
31
32#pragma once
33
34#include "ecs/component.h"
35#include <raylib.h>
36
37#define NO_MAX_SPEED 999999
38#define NO_MIN_SPEED -999999
39
40typedef struct Pool Pool;
41
46typedef struct Physics {
47 /* Données */
48 float speed; // Vitesse, speed < 0 => angle *= -1
49 float accel; // Accéleration
50 float maxSpd; // Vitesse terminale
51 float minSpd; // Vitesse minimale
52 float angVel; // Vélocité angulaire
53 Vector2 force;
54
55 /* Calcul */
56 Vector2 velocity;
58
60
61DECLARE_SETTER_GETTER(Physics, float, speed)
62DECLARE_SETTER_GETTER(Physics, Vector2, velocity)
63DECLARE_SETTER_GETTER(Physics, float, accel)
64DECLARE_SETTER_GETTER(Physics, float, maxSpd)
65DECLARE_SETTER_GETTER(Physics, float, minSpd)
66DECLARE_SETTER_GETTER(Physics, float, angVel)
68
77extern Physics Physics_create_speed(float speed);
78
84extern void Physics_update_all(Pool *p);
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
#define MAX_ENTITIES
Definition ecs.h:14
void Physics_update_all(Pool *p)
Met a jour toutes les composantes physiques.
Physics Physics_create_speed(float speed)
Crée une composante physique avec uniquement la speed.
composante physique dans l'ECS Cette composante ajoute les notions de vitesse, accélération,...
Definition physics.h:46
Vector2 velocity
Definition physics.h:56
float maxSpd
Definition physics.h:50
float accel
Definition physics.h:49
float minSpd
Definition physics.h:51
Vector2 force
Definition physics.h:53
float angVel
Definition physics.h:52
float speed
Definition physics.h:48
La pool est la structure qui contient l'Entity Component System Elle gêre les différentes composantes...
Definition pool.h:42