From 1f94e108b08a33df18203a1b99b320d9601c08d1 Mon Sep 17 00:00:00 2001 From: onelin Date: Sun, 24 May 2026 18:26:17 +0200 Subject: Use COUNT --- state_mainstate/src/mainstate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/state_mainstate/src/mainstate.c b/state_mainstate/src/mainstate.c index 8f9c39b..e173e23 100644 --- a/state_mainstate/src/mainstate.c +++ b/state_mainstate/src/mainstate.c @@ -10,7 +10,6 @@ #include #include - #include // Plain-C interface #include // Output data structure #include // Post processing flags @@ -91,7 +90,6 @@ ShaderBuffer shaderbuf_quad_fullscreen[] = { SHADERBUFFER_NEW(f32, COUNT(quad_uv), 2, quad_uv, staticdraw), SHADERBUFFER_NEW(u16, COUNT(quad_ibo), 3, quad_ibo, staticdraw | ShaderBuffer_Type_vertexIndex), }; -#undef COUNT /* * https://learnopengl.com/Lighting/Basic-Lighting @@ -317,7 +315,7 @@ void mainstate_init(Window *restrict w, mainstate_state *state, void* arg) { } // ----------- Calculate normals TODO MOVE TO ENGINE - for (usize i = 0; i < sizeof(crate) / sizeof(crate[0]) / 3; i++) { + for (usize i = 0; i < COUNT(crate) / 3; i++) { // Face index const usize f = i / 3; // Face offset @@ -565,7 +563,7 @@ void mainstate_init(Window *restrict w, mainstate_state *state, void* arg) { // There's a strange duality between using functions to change render_targets, // and manipulating the datastructures directly. - window_init_renderstack(w, sizeof(p) / sizeof(p[0]), sizeof(t) / sizeof(t[0]), p, t); + window_init_renderstack(w, COUNT(p), COUNT(t), p, t); w->render_targets->camera_reset_callback[FRAMEBUF_UI] = &perspective_update_callback_ui; w->render_targets->framebuffer_size_callback[FRAMEBUF_UI] = &window_resize_callback_ui; w->render_targets->camera_reset_callback[FRAMEBUF_CAM] = &perspective_update_callback; @@ -752,3 +750,5 @@ StateType mainstate_update(Window *restrict w, mainstate_state *state, f64 dt) { return next_state; } + +#undef COUNT -- cgit v1.3