Fixed some typos, set components functions to inline and added "hitbox activated" param to hitbox component.
This commit is contained in:
parent
357839cc71
commit
85c2777b90
|
|
@ -1 +1 @@
|
||||||
Subproject commit dc0a1f36568146b8b9dd86fd2e7634464280179b
|
Subproject commit af462380762093bee9e471799c7ce31732a4b248
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef ANIMATION_SYSTEM_H
|
#ifndef ANIMATION_SYSTEM_H
|
||||||
#define ANIMATION_SYSTEM_H
|
#define ANIMATION_SYSTEM_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include "ecs.h"
|
#include "ecs.h"
|
||||||
#include "sprite_component.h"
|
#include "sprite_component.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef HITBOX_COMPONENT_H
|
#ifndef HITBOX_COMPONENT_H
|
||||||
#define HITBOX_COMPONENT_H
|
#define HITBOX_COMPONENT_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include "ecs.h"
|
#include "ecs.h"
|
||||||
#include "transform_component.h"
|
#include "transform_component.h"
|
||||||
#include "vector2d.h"
|
#include "vector2d.h"
|
||||||
|
|
@ -10,6 +11,7 @@ typedef struct hitbox_component_data_t {
|
||||||
fvector2d_t position;
|
fvector2d_t position;
|
||||||
fvector2d_t scale;
|
fvector2d_t scale;
|
||||||
frect_t bounds;
|
frect_t bounds;
|
||||||
|
bool activated;
|
||||||
} hitbox_component_data_t;
|
} hitbox_component_data_t;
|
||||||
|
|
||||||
int hitbox_component_init(component_t *component);
|
int hitbox_component_init(component_t *component);
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ int hitbox_component_init(component_t *component)
|
||||||
.y = 1.0f
|
.y = 1.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
|
component_data->activated = true;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include "transform_component.h"
|
#include "transform_component.h"
|
||||||
|
|
||||||
// No args
|
// No args
|
||||||
int player_system_init(component_t *component)
|
inline int player_system_init(component_t *component)
|
||||||
{
|
{
|
||||||
player_system_data_t *system_data = component->component_data;
|
player_system_data_t *system_data = component->component_data;
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ static inline int player_system_set_animation_and_speed(player_system_data_t *sy
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int player_system_update(component_t *component)
|
inline int player_system_update(component_t *component)
|
||||||
{
|
{
|
||||||
player_system_data_t *system_data = component->component_data;
|
player_system_data_t *system_data = component->component_data;
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ int player_system_update(component_t *component)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int player_system_destroy(component_t *component)
|
inline int player_system_destroy(component_t *component)
|
||||||
{
|
{
|
||||||
player_system_data_t *component_data = component->component_data;
|
player_system_data_t *component_data = component->component_data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
// Arg : const char *name
|
// Arg : const char *name
|
||||||
int sprite_component_init(component_t *component)
|
inline int sprite_component_init(component_t *component)
|
||||||
{
|
{
|
||||||
sprite_component_data_t *component_data = component->component_data;
|
sprite_component_data_t *component_data = component->component_data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int transform_component_init(component_t *component)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int transform_component_update(component_t *component)
|
inline int transform_component_update(component_t *component)
|
||||||
{
|
{
|
||||||
transform_component_data_t *component_data = component->component_data;
|
transform_component_data_t *component_data = component->component_data;
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ int transform_component_update(component_t *component)
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
|
|
||||||
int transform_component_draw(component_t *component)
|
inline int transform_component_draw(component_t *component)
|
||||||
{
|
{
|
||||||
transform_component_data_t *component_data = component->component_data;
|
transform_component_data_t *component_data = component->component_data;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue