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 {
|
2020-09-14 14:37:46 +02:00
|
|
|
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 */
|
2020-09-23 12:19:40 +02:00
|
|
|
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;
|
|
|
|
|
2020-09-23 12:19:40 +02:00
|
|
|
#include "player.h"
|
|
|
|
#include "level.h"
|
|
|
|
|
|
|
|
/* update camera position */
|
2020-09-11 18:07:53 +02:00
|
|
|
void camera_step(Camera *camera);
|
2020-09-17 14:14:21 +02:00
|
|
|
|
2020-09-23 12:19:40 +02:00
|
|
|
/* set the min and max position of the camera and center it on player */
|
|
|
|
void camera_init(Camera *camera, Player *player, const Level *level);
|
|
|
|
|
2020-09-14 14:37:46 +02:00
|
|
|
/* draw a dot corresponding to camera position */
|
2020-09-18 11:12:34 +02:00
|
|
|
void camera_draw_debug(Camera *camera);
|
2020-09-11 18:07:53 +02:00
|
|
|
|
|
|
|
#endif /* _DEF_CAMERA */
|