mirror of
https://github.com/zoriya/ForecastingVillage.git
synced 2026-05-30 09:38:33 +00:00
added an health component
This commit is contained in:
+1
-1
@@ -252,7 +252,7 @@ add_executable(my_rpg
|
||||
src/systems/map_movement_system.c
|
||||
lib/gamacon/src/components/renderers/anim_utils.c
|
||||
lib/gamacon/src/isometry/map_utilities.c
|
||||
lib/gamacon/src/sfml_renderer/sfml_utilities.c lib/gamacon/src/components/map_linker.c lib/gamacon/include/components/map_linker.h lib/gamacon/src/systems/map_linker_system.c)
|
||||
lib/gamacon/src/sfml_renderer/sfml_utilities.c lib/gamacon/src/components/map_linker.c lib/gamacon/include/components/map_linker.h lib/gamacon/src/systems/map_linker_system.c src/components/health_component.c include/components/health_component.h)
|
||||
|
||||
add_compile_options(-W -Wall -Wextra -Wshadow)
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2019
|
||||
** Gamacon
|
||||
** File description:
|
||||
** health_component
|
||||
*/
|
||||
|
||||
#ifndef MY_RPG_HEALTH_COMPONENT_H
|
||||
#define MY_RPG_HEALTH_COMPONENT_H
|
||||
|
||||
#include "component.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
struct health_component
|
||||
{
|
||||
gc_component base;
|
||||
unsigned int health;
|
||||
};
|
||||
|
||||
extern const struct health_component health_component;
|
||||
|
||||
#endif //MY_RPG_HEALTH_COMPONENT_H
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2020
|
||||
** My3D
|
||||
** File description:
|
||||
** health component
|
||||
*/
|
||||
|
||||
#include "xml.h"
|
||||
#include "component.h"
|
||||
#include "components/health_component.h"
|
||||
|
||||
static void health_ctr(void *component, va_list args)
|
||||
{
|
||||
struct controllable_component *cmp = (struct controllable_component *)\
|
||||
component;
|
||||
|
||||
cmp->movement_x = 0;
|
||||
cmp->movement_y = 0;
|
||||
cmp->move_callback = 0;
|
||||
(void)args;
|
||||
}
|
||||
|
||||
static void health_fdctr(gc_entity *entity, gc_scene *scene, \
|
||||
void *component, node *n)
|
||||
{
|
||||
struct controllable_component *cmp = (struct controllable_component *)\
|
||||
component;
|
||||
|
||||
cmp->movement_x = 0;
|
||||
cmp->movement_y = 0;
|
||||
cmp->move_callback = 0;
|
||||
(void)scene;
|
||||
(void)entity;
|
||||
(void)n;
|
||||
}
|
||||
|
||||
static void health_dtr(void *component)
|
||||
{
|
||||
(void)component;
|
||||
}
|
||||
|
||||
static char *health_serialize(void *component)
|
||||
{
|
||||
(void)component;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
const struct health_component health_component = {
|
||||
base: {
|
||||
name: "health_component",
|
||||
size: sizeof(struct health_component),
|
||||
dependencies: (char *[]){
|
||||
"event_component",
|
||||
NULL
|
||||
},
|
||||
ctr: &health_ctr,
|
||||
fdctr: &health_fdctr,
|
||||
dtr: &health_dtr,
|
||||
serialize: &health_serialize,
|
||||
destroy: &component_destroy
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user