aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/sdl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/sdl.zig')
-rw-r--r--src/frontend/sdl.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/frontend/sdl.zig b/src/frontend/sdl.zig
index c9a4bf2..bf2fbbb 100644
--- a/src/frontend/sdl.zig
+++ b/src/frontend/sdl.zig
@@ -1,6 +1,6 @@
const std = @import("std");
const sdl = @cImport({
- @cInclude("SDL.h");
+ @cInclude("SDL3/SDL.h");
});
const Action = @import("../actions.zig").Action;
const IOInterface = @import("io_interface.zig").IOInterface;
@@ -31,7 +31,7 @@ pub const IO = struct {
while (!quit) {
_ = sdl.SDL_WaitEvent(&event);
switch (event.type) {
- sdl.SDL_QUIT => quit = true,
+ sdl.SDL_EVENT_QUIT => quit = true,
else => {},
}
}
@@ -44,17 +44,17 @@ pub const IO = struct {
io.allocator = allocator;
io.sprites = std.ArrayList([*c]sdl.SDL_Surface).init(allocator);
- if (sdl.SDL_Init(sdl.SDL_INIT_VIDEO) < 0) return error.SDL_Failed;
+ if (!sdl.SDL_Init(sdl.SDL_INIT_VIDEO)) return error.SDL_Failed;
io.screen = sdl.SDL_CreateWindow(
"urlg",
- sdl.SDL_WINDOWPOS_UNDEFINED,
- sdl.SDL_WINDOWPOS_UNDEFINED,
640,
480,
0,
);
+ if (io.screen == null) return error.SDL_Failed;
+
io.loadSprite() catch |err| {
io.deinit();
return err;
@@ -68,7 +68,7 @@ pub const IO = struct {
pub fn deinit(self: *IO) void {
for (self.sprites.items) |sprite| {
- _ = sdl.SDL_FreeSurface(sprite);
+ _ = sdl.SDL_DestroySurface(sprite);
}
self.sprites.deinit();