about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authormakefunstuff <[email protected]>2024-07-03 00:27:18 +0200
committermakefunstuff <[email protected]>2024-07-03 00:27:18 +0200
commit9918f45d60b85a325dd74003ff5b08d8bfab0e4f (patch)
tree1f618a9c8ce51e9205eb635615bbe2108311748d /src
parent93e7e42605a5f62519c30c86ab65bd529edb3389 (diff)
downloadtinkerbunk-9918f45d60b85a325dd74003ff5b08d8bfab0e4f.tar.gz
works
Diffstat (limited to '')
-rw-r--r--src/sdl-window.zig16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/sdl-window.zig b/src/sdl-window.zig
index 2e292ed..50d3f0c 100644
--- a/src/sdl-window.zig
+++ b/src/sdl-window.zig
@@ -23,9 +23,6 @@ pub fn present_sdl_window() !void {
     };
     defer c.SDL_DestroyRenderer(renderer);
 
-    const color = c.SDL_Color{ .r = 255, .g = 255, .b = 255, .a = 255 };
-    _ = c.SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, color.a);
-
     const rect_height = 100;
     const rect_width = 100;
 
@@ -40,16 +37,21 @@ pub fn present_sdl_window() !void {
 
         while (c.SDL_PollEvent(&event) != 0) {
             switch (event.type) {
-                c.SDL_Quit => {
+                c.SDL_QUIT => {
                     quit = true;
                 },
                 else => {},
             }
         }
-        _ = c.SDL_RenderFillRect(renderer, &rect);
+        const bg_color = c.SDL_Color{ .r = 255, .g = 255, .b = 255, .a = 255 };
+        _ = c.SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a);
+
         _ = c.SDL_RenderClear(renderer);
-        _ = c.SDL_RenderPresent(renderer);
 
-        _ = c.SDL_Delay(20);
+        const rect_color = c.SDL_Color{ .r = 0, .g = 0, .b = 255, .a = 255 };
+        _ = c.SDL_SetRenderDrawColor(renderer, rect_color.r, rect_color.g, rect_color.b, rect_color.a);
+
+        _ = c.SDL_RenderFillRect(renderer, &rect);
+        _ = c.SDL_RenderPresent(renderer);
     }
 }