summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-08-25 18:52:00 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-08-25 18:52:00 +0100
commit32934c0c1a0cae9eff31091b462341e9c10b5da3 (patch)
tree630b6789d4f84f03988bbda6780a27832f2576fc /main.c
parent08bca7b68ebf3cb994644d427c447d0b44cde7c3 (diff)
downloadabelian-sandpile-32934c0c1a0cae9eff31091b462341e9c10b5da3.tar.gz
abelian-sandpile-32934c0c1a0cae9eff31091b462341e9c10b5da3.tar.bz2
abelian-sandpile-32934c0c1a0cae9eff31091b462341e9c10b5da3.zip
(main)+camera
This will be useful for zooming in.
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.c b/main.c
index 8e53fd0..e9f7c8d 100644
--- a/main.c
+++ b/main.c
@@ -7,6 +7,7 @@
#include <stdio.h>
#include <raylib.h>
+#include <raymath.h>
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();