aboutsummaryrefslogtreecommitdiff
path: root/sdl2/sdl2.ha
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2021-12-12 13:06:13 +0100
committerDrew DeVault <sir@cmpwn.com>2021-12-12 13:06:13 +0100
commitaad6ff05cc6110da6b458d9631604dacb44bcc61 (patch)
tree9b1704f455bcbc19233f61cfd78276fc56143a5b /sdl2/sdl2.ha
parentsdl2::mixer: initial commit (diff)
downloadhare-chip8-aad6ff05cc6110da6b458d9631604dacb44bcc61.tar.gz
all: add error handling on init
Diffstat (limited to '')
-rw-r--r--sdl2/sdl2.ha6
1 files changed, 5 insertions, 1 deletions
diff --git a/sdl2/sdl2.ha b/sdl2/sdl2.ha
index b71c890..08e1234 100644
--- a/sdl2/sdl2.ha
+++ b/sdl2/sdl2.ha
@@ -13,8 +13,12 @@ export type init_flags = enum uint {
EVERYTHING = TIMER | AUDIO | VIDEO | EVENTS | JOYSTICK | HAPTIC | GAMECONTROLLER | SENSOR,
};
+@symbol("SDL_Init") fn _init(flags: init_flags) int;
+
// This function initializes the subsystems specified by 'flags'.
-export @symbol("SDL_Init") fn init(flags: init_flags) void;
+export fn init(flags: init_flags) (void | error) = {
+ return wrapvoid(_init(flags));
+};
// This function cleans up all initialized subsystems. You should call it upon
// all exit conditions.