freak-engine/src/entity/draw_hitbox.c

24 lines
527 B
C

#include "entity.h"
#include <gint/display.h>
void
entity_draw_hitbox(void *restrict entity)
{
const struct Entity *const e = entity;
const int x = e->x + e->hb_x;
const int y = e->y + e->hb_y;
drect_border(e->x, e->y, e->x + 2, e->y + 2, C_NONE, 1, e->hb_color);
drect_border(x, y, x + e->hb_w - 1, y + e->hb_h - 1, C_NONE, 1,
e->hb_color);
}
void
entity_grid_draw_hitboxes(void)
{
int i;
i = ENTITY_GRID_SIZE;
while (i-- > 0)
if (g_entity_grid[i] != NULL)
entity_draw_hitbox(g_entity_grid[i]);
}