Compare commits
2 Commits
34ee7e2a57
...
d648bcbb9b
| Author | SHA1 | Date |
|---|---|---|
|
|
d648bcbb9b | |
|
|
a4b970636b |
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue