aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cmd/demo/main.ha6
-rw-r--r--sdl2/keyboard.ha2
-rw-r--r--sdl2/sdl2.ha30
3 files changed, 18 insertions, 20 deletions
diff --git a/cmd/demo/main.ha b/cmd/demo/main.ha
index a6f2a92..82de229 100644
--- a/cmd/demo/main.ha
+++ b/cmd/demo/main.ha
@@ -33,9 +33,9 @@ export fn main() void = {
};
fn run() (void | fs::error | sdl2::error) = {
- sdl2::SDL_Init(sdl2::init_flags::VIDEO
- | sdl2::init_flags::AUDIO
- | sdl2::init_flags::GAMECONTROLLER)!;
+ sdl2::SDL_Init(sdl2::SDL_INIT_VIDEO
+ | sdl2::SDL_INIT_AUDIO
+ | sdl2::SDL_INIT_GAMECONTROLLER)!;
defer sdl2::SDL_Quit();
image::IMG_Init(image::IMG_InitFlags::PNG | image::IMG_InitFlags::JPG)!;
defer image::IMG_Quit();
diff --git a/sdl2/keyboard.ha b/sdl2/keyboard.ha
index 97b0a21..eb38afd 100644
--- a/sdl2/keyboard.ha
+++ b/sdl2/keyboard.ha
@@ -419,7 +419,7 @@ export type SDL_Keycode = enum uint {
y = 'y',
z = 'z',
- CAPSLOCK = SDL_Scancode::CAPSLOCK | 1: SDL_Scancode << 30,
+ CAPSLOCK = SDL_Scancode::CAPSLOCK | 1: SDL_Scancode << 30: SDL_Scancode,
F1 = SDL_Scancode::F1 | 1: SDL_Scancode << 30,
F2 = SDL_Scancode::F2 | 1: SDL_Scancode << 30,
diff --git a/sdl2/sdl2.ha b/sdl2/sdl2.ha
index d36ff2b..7035e04 100644
--- a/sdl2/sdl2.ha
+++ b/sdl2/sdl2.ha
@@ -1,22 +1,20 @@
-// These are the flags which may be passed to [[SDL_Init]]. You should specify the
-// subsystems which you will be using in your application.
-export type init_flags = enum uint {
- TIMER = 0x00000001u,
- AUDIO = 0x00000010u,
- VIDEO = 0x00000020u,
- JOYSTICK = 0x00000200u,
- HAPTIC = 0x00001000u,
- GAMECONTROLLER = 0x00002000u,
- EVENTS = 0x00004000u,
- SENSOR = 0x00008000u,
- NOPARACHUTE = 0x00100000u,
- EVERYTHING = TIMER | AUDIO | VIDEO | EVENTS | JOYSTICK | HAPTIC | GAMECONTROLLER | SENSOR,
-};
+export def SDL_INIT_TIMER: uint = 0x00000001u;
+export def SDL_INIT_AUDIO: uint = 0x00000010u;
+export def SDL_INIT_VIDEO: uint = 0x00000020u;
+export def SDL_INIT_JOYSTICK: uint = 0x00000200u;
+export def SDL_INIT_HAPTIC: uint = 0x00001000u;
+export def SDL_INIT_GAMECONTROLLER: uint = 0x00002000u;
+export def SDL_INIT_EVENTS: uint = 0x00004000u;
+export def SDL_INIT_SENSOR: uint = 0x00008000u;
+export def SDL_INIT_NOPARACHUTE: uint = 0x00100000u;
+export def SDL_INIT_EVERYTHING: uint = SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO
+ | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC
+ | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR;
-@symbol("SDL_Init") fn _SDL_Init(flags: init_flags) int;
+@symbol("SDL_Init") fn _SDL_Init(flags: uint) int;
// This function initializes the subsystems specified by 'flags'.
-export fn SDL_Init(flags: init_flags) (void | error) = {
+export fn SDL_Init(flags: uint) (void | error) = {
return wrapvoid(_SDL_Init(flags));
};