Adoranda/src/camera.c

18 lines
371 B
C
Raw Normal View History

2021-08-25 01:01:43 +02:00
#include "vec2.h"
#include "camera.h"
2021-08-27 22:50:00 +02:00
#include "game.h"
#include "define.h"
#include "player.h"
2021-08-25 01:01:43 +02:00
struct Camera camera_new(struct Vec2f *target) {
return (struct Camera) {
.pos = *target,
.offset = vec2f_vec2(*target),
.target = target,
};
}
2021-08-25 01:30:30 +02:00
void camera_update(struct Camera *c) {
c->pos = vec2f_lerp(c->pos, *c->target, 0.08);
2021-08-25 01:30:30 +02:00
c->offset = vec2f_vec2(c->pos);
2021-08-27 22:50:00 +02:00
}