From 723f879f85f25c2d466146e08261e0ae993c72b6 Mon Sep 17 00:00:00 2001 From: Simponic Date: Tue, 11 Aug 2020 22:13:56 -0600 Subject: Added basic camera controls --- source/camera.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 source/camera.c (limited to 'source/camera.c') diff --git a/source/camera.c b/source/camera.c new file mode 100644 index 0000000..c905d74 --- /dev/null +++ b/source/camera.c @@ -0,0 +1,15 @@ +#include "../include/camera.h" + +CAMERA createCamera (int x, int y) { + // Create camera from a point + CAMERA temp; + temp.x = x; + temp.y = y; + return temp; +} + +void applyCameraShift (CAMERA *camera, int *x, int *y) { + // Apply camera shift to a coordinate + *x = *x - camera->x; + *y = *y - camera->y; +} -- cgit v1.2.3-70-g09d2