jtmm2/include/camera.h

28 lines
733 B
C
Raw Normal View History

2020-09-11 18:07:53 +02:00
#ifndef _DEF_CAMERA
#define _DEF_CAMERA
#include "vec.h"
2020-12-21 12:18:55 +01:00
typedef struct Camera {
Vec pos;
2020-09-21 14:52:28 +02:00
Vec offset; /* adjusted pixel offset based on pos */
2020-09-14 10:33:01 +02:00
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 */
2020-09-11 18:07:53 +02:00
float speed; /* camera lerp speed with 0 < speed <= 1 */
} Camera;
#include "player.h"
#include "level.h"
/* update camera position */
2020-09-11 18:07:53 +02:00
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);
2020-09-11 18:07:53 +02:00
#endif /* _DEF_CAMERA */