From 33a9f50b1eb2a6c166ce99aac8dcff4e5dc4d686 Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Thu, 7 Mar 2024 10:05:32 +0800 Subject: [PATCH] Camera (wip) --- camera.c | 12 ++++++++++++ camera.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 camera.c create mode 100644 camera.h diff --git a/camera.c b/camera.c new file mode 100644 index 0000000..bb3d365 --- /dev/null +++ b/camera.c @@ -0,0 +1,12 @@ + +#include "camera.h" +#include "types.h" + + +System_Camera *camera_NewSystem(App *super) { + System_Camera *sys = zero_malloc(sizeof(System_Camera)); + sys->super = super; +} +void camera_DeleteSystem(System_Camera *sys); + +void camera_Advance(System_Camera *sys, Duration deltaTime); diff --git a/camera.h b/camera.h new file mode 100644 index 0000000..8ac8641 --- /dev/null +++ b/camera.h @@ -0,0 +1,30 @@ +#pragma once + +#include "player.h" +#include "types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct _App App; + +typedef struct { + App *super; + Component_Player *player; + + Box2 cam, target; // Current & target camera + double speed; // Fraction of distance between cam & target to be covered in 1 sec +} System_Camera; + +System_Camera *camera_NewSystem(App *super); +void camera_DeleteSystem(System_Camera *sys); + +void camera_Advance(System_Camera *sys, Duration deltaTime); + + +#ifdef __cplusplus +} +#endif