aboutsummaryrefslogtreecommitdiff
path: root/sdl2
diff options
context:
space:
mode:
Diffstat (limited to 'sdl2')
-rw-r--r--sdl2/image/image.ha10
-rw-r--r--sdl2/sdl2.ha6
2 files changed, 11 insertions, 5 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;
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.