Compare commits

...

2 Commits

Author SHA1 Message Date
Ulysse Cura d648bcbb9b Adding const to entity get component. 2026-08-04 21:02:13 +02:00
Ulysse Cura a4b970636b Fixed SDL3 functions names. 2026-08-04 21:01:55 +02:00
3 changed files with 5 additions and 9 deletions

View File

@ -103,14 +103,10 @@ static inline bool condition_is_component_type(elem_t *elem, va_list args)
return ((component_t *)elem->data)->type == va_arg(args, component_type_t);
}
inline component_t *entity_get_component(entity_t *entity, component_type_t component_type)
inline component_t *entity_get_component(const entity_t *entity, component_type_t component_type)
{
elem_t *component_elem = linked_list_get_if(&entity->components, condition_is_component_type, component_type);
if(!component_elem)
{
error_printf("Entity with id:%lu doesn't have componant of type : %d", entity->id, component_type);
return NULL;
}
if(!component_elem) return NULL;
component_t *component = component_elem->data;

View File

@ -53,7 +53,7 @@ int destroy_entity(entity_t *entity);
component_t *entity_new_component(entity_t *entity, component_type_t component_type);
component_t *entity_get_component(entity_t *entity, component_type_t component_type);
component_t *entity_get_component(const entity_t *entity, component_type_t component_type);
int update_entity(entity_t *entity);

View File

@ -97,7 +97,7 @@ void frect_to_rect(const frect_t *frect, rect_t *rect);
*
* @return True if there is an intersection, else false.
*/
#define has_intersection(A, B) SDL_HasIntersection(A, B)
#define has_intersection(A, B) SDL_HasRectIntersection(A, B)
/**
* @brief Verify if there is a intersction between two rectangles. (float)
@ -107,7 +107,7 @@ void frect_to_rect(const frect_t *frect, rect_t *rect);
*
* @return True if there is an intersection, else false.
*/
#define fhas_intersection(A, B) SDL_HasIntersectionF(A, B)
#define fhas_intersection(A, B) SDL_HasRectIntersectionFloat(A, B)
/**
* @brief Verify if there is an intersection between two rectangles and get the intersection rectangle. (int)