aboutsummaryrefslogtreecommitdiff
path: root/sdl2/image/image.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/image/image.ha
parentsdl2::mixer: initial commit (diff)
downloadhare-chip8-aad6ff05cc6110da6b458d9631604dacb44bcc61.tar.gz
all: add error handling on init
Diffstat (limited to '')
-rw-r--r--sdl2/image/image.ha10
1 files changed, 6 insertions, 4 deletions
diff --git a/sdl2/image/image.ha b/sdl2/image/image.ha
index 6cabee2..8a48009 100644
--- a/sdl2/image/image.ha
+++ b/sdl2/image/image.ha
@@ -12,11 +12,13 @@ export type init_flags = enum int {
WEBP = 0x00000008,
};
+@symbol("IMG_Init") fn _init(flags: init_flags) int;
+
// Loads dynamic libraries and prepares them for use. Flags should be one or
-// more flags from IMG_InitFlags OR'd together.
-//
-// Returns the flags successfully initialized, or 0 on failure.
-export @symbol("IMG_Init") fn init(flags: init_flags) int;
+// more flags from [[init_flags]] OR'd together.
+export fn init(flags: init_flags) (void | sdl2::error) = {
+ return sdl2::wrapvoid(_init(flags));
+};
// Unloads libraries loaded with [[init]]
export @symbol("IMG_Quit") fn quit() void;