Adoranda/src/camera.c

17 lines
333 B
C
Raw Normal View History

2021-08-25 01:01:43 +02:00
#include "vec2.h"
2021-08-25 01:30:30 +02:00
#include "define.h"
2021-08-25 01:01:43 +02:00
#include "camera.h"
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) {
2021-08-25 01:42:40 +02:00
c->pos = vec2f_lerp(c->pos, *c->target, 0.2);
2021-08-25 01:30:30 +02:00
c->offset = vec2f_vec2(c->pos);
}