diff options
author | makefunstuff <[email protected]> | 2024-07-03 00:27:18 +0200 |
---|---|---|
committer | makefunstuff <[email protected]> | 2024-07-03 00:27:18 +0200 |
commit | 9918f45d60b85a325dd74003ff5b08d8bfab0e4f (patch) | |
tree | 1f618a9c8ce51e9205eb635615bbe2108311748d | |
parent | 93e7e42605a5f62519c30c86ab65bd529edb3389 (diff) | |
download | tinkerbunk-9918f45d60b85a325dd74003ff5b08d8bfab0e4f.tar.gz |
works
-rw-r--r-- | src/sdl-window.zig | 16 |
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); } } |