jtmm2/include/camera.h

28 lines
733 B
C

#ifndef _DEF_CAMERA
#define _DEF_CAMERA
#include "vec.h"
typedef struct Camera {
Vec pos;
Vec offset; /* adjusted pixel offset based on pos */
Vec *target; /* the target position to lerp on */
Vec min; /* Values set by level_set used to limit camera position */
Vec max; /* See min comment */
float speed; /* camera lerp speed with 0 < speed <= 1 */
} Camera;
#include "player.h"
#include "level.h"
/* update camera position */
void camera_step(Camera *camera);
/* set the min and max position of the camera and center it on player */
void camera_init(Camera *camera, Player *player, const Level *level);
/* draw a dot corresponding to camera position */
void camera_draw_debug(Camera *camera);
#endif /* _DEF_CAMERA */