From 32934c0c1a0cae9eff31091b462341e9c10b5da3 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 25 Aug 2023 18:52:00 +0100 Subject: (main)+camera This will be useful for zooming in. --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 8e53fd0..e9f7c8d 100644 --- a/main.c +++ b/main.c @@ -7,6 +7,7 @@ #include #include +#include struct State { @@ -49,15 +50,17 @@ int main(void) state.data = calloc(state.dwidth * state.dwidth, sizeof(*state.data)); state.multiplier = state.window_len / state.dwidth; + Camera2D camera = {0}; + camera.zoom = 1.0f; InitWindow(state.window_len, state.window_len, "Abelian sand pile"); SetTargetFPS(60); + while (!WindowShouldClose()) { step(&state); BeginDrawing(); ClearBackground(BLACK); - DrawText("Hello, world!", 100, 100, 25, RAYWHITE); - + BeginMode2D(camera); for (size_t i = 0; i < state.dwidth; ++i) for (size_t j = 0; j < state.dwidth; ++j) { @@ -75,6 +78,7 @@ int main(void) DrawRectangle(i * state.multiplier, j * state.multiplier, state.multiplier, state.multiplier, c); } + EndMode2D(); EndDrawing(); } CloseWindow(); -- cgit v1.2.3-13-gbd6f