diff --git a/CMakeLists.txt b/CMakeLists.txt index 77b6f8f..2471d03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,7 +272,7 @@ add_executable(my_rpg src/components/dialog_holder.c include/components/dialog_holder.h src/systems/dialog_manager.c -) + src/components/ui_display_component.c include/components/ui_display_component.h) add_compile_options(-W -Wall -Wextra -Wshadow) diff --git a/Makefile b/Makefile index 26dc2ab..869de8c 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,10 @@ SRC = src/main.c \ src/components/dialog_holder.c \ src/systems/map_movement_system.c \ src/systems/dialog_manager.c \ - src/systems/controllers/keyboard_controller_system.c + src/systems/controllers/keyboard_controller_system.c \ + src/components/ui_display_component.c \ + src/components/health_component.c \ + src/components/health_methods.c OBJ = $(SRC:%.c=%.o) diff --git a/include/components/ui_display_component.h b/include/components/ui_display_component.h new file mode 100644 index 0000000..7863532 --- /dev/null +++ b/include/components/ui_display_component.h @@ -0,0 +1,23 @@ +/* +** EPITECH PROJECT, 2020 +** my_rpg +** File description: +** ui display component +*/ + +#ifndef MY_RPG_UI_DISPLAY_COMPONENT_H +#define MY_RPG_UI_DISPLAY_COMPONENT_H + +#include +#include "component.h" + +struct ui_display_component +{ + gc_component base; + bool display_health; + bool display_xp; +}; + +extern const struct ui_display_component ui_display_component; + +#endif //MY_RPG_UI_DISPLAY_COMPONENT_H diff --git a/src/components/ui_display_component.c b/src/components/ui_display_component.c new file mode 100644 index 0000000..6f602d2 --- /dev/null +++ b/src/components/ui_display_component.c @@ -0,0 +1,54 @@ +/* +** EPITECH PROJECT, 2020 +** my_rpg +** File description: +** ui display component +*/ + +#include "xml.h" +#include "component.h" +#include "components/ui_display_component.h" + +static void ui_display_ctr(void *component, va_list args) +{ + struct ui_display_component *cmp = (struct ui_display_component *)\ +component; + (void)args; +} + +static void ui_display_fdctr(gc_entity *entity, gc_scene *scene, \ +void *component, node *n) +{ + struct ui_display_component *cmp = (struct ui_display_component *)\ +component; + + (void)scene; + (void)entity; + (void)n; +} + +static void ui_display_dtr(void *component) +{ + (void)component; +} + +static char *ui_display_serialize(void *component) +{ + (void)component; + return (NULL); +} + +const struct ui_display_component ui_display_component = { + base: { + name: "ui_display_component", + size: sizeof(struct ui_display_component), + dependencies: (char *[]){ + NULL + }, + ctr: &ui_display_ctr, + fdctr: &ui_display_fdctr, + dtr: &ui_display_dtr, + serialize: &ui_display_serialize, + destroy: &component_destroy + } +}; \ No newline at end of file