RogueLife/src/comp/physical.h

30 lines
718 B
C

//---
// physical: Component for entities that exist on the map
//
// This basic component gives a position and size (hitbox) to every object on
// the map. It's a requirement for several others, including [visible] and
// [mechanical], since the position is very commonly used.
//---
#pragma once
#include "comp/entity.h"
#include "geometry.h"
typedef struct
{
/* Current position, in absolute map coordinates */
fixed_t x, y;
/* Hitbox on the floor, relative to (x,y) */
rect hitbox;
/* Direction facing */
uint8_t facing;
} physical_t;
/* Entity position as a vector */
vec2 physical_pos(entity_t const *e);
/* Hitbox offset by position */
rect physical_abs_hitbox(entity_t const *e);