From c322c17a69fc756b494124d4deab6909ee9134cb Mon Sep 17 00:00:00 2001 From: realtradam Date: Thu, 22 Jun 2023 20:30:29 -0400 Subject: implement 2d camera system --- include/rodeo/gfx.h | 13 +++++++++++++ include/rodeo/gfx_t.h | 11 +++++++++++ 2 files changed, 24 insertions(+) (limited to 'include') diff --git a/include/rodeo/gfx.h b/include/rodeo/gfx.h index 15ce3ad..07d8430 100644 --- a/include/rodeo/gfx.h +++ b/include/rodeo/gfx.h @@ -147,6 +147,19 @@ rodeo_gfx_matrix_size(void); uint32_t rodeo_gfx_matrix_capacity(void); +void +rodeo_gfx_camera_2d_begin(rodeo_gfx_camera_2d_t camera); + +void +rodeo_gfx_camera_2d_end(void); + +#define \ +mrodeo_gfx_camera_do(camera) \ + mrodeo_defer_do( \ + rodeo_gfx_camera_2d_begin(camera), \ + rodeo_gfx_camera_2d_end() \ + ) + #define \ mrodeo_gfx_scissor_do(rectangle) \ mrodeo_defer_do( \ diff --git a/include/rodeo/gfx_t.h b/include/rodeo/gfx_t.h index 63811c5..3d206c2 100644 --- a/include/rodeo/gfx_t.h +++ b/include/rodeo/gfx_t.h @@ -3,6 +3,7 @@ // -- internal -- // public #include "rodeo_types.h" +#include "rodeo/math/vec2_t.h" // -- system -- #include @@ -67,3 +68,13 @@ rodeo_gfx_vertex_t; typedef uint16_t rodeo_gfx_index_t; +typedef +struct +{ + rodeo_math_vec2_t target; + float turns; + float zoom; + rodeo_math_vec2_t offset; +} +rodeo_gfx_camera_2d_t; + -- cgit v1.2.3