diff options
Diffstat (limited to 'src/zxc.zig')
-rw-r--r-- | src/zxc.zig | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/zxc.zig b/src/zxc.zig index d826585..cee099f 100644 --- a/src/zxc.zig +++ b/src/zxc.zig @@ -4,7 +4,7 @@ const Self = @This(); pub const Scancode = sdl.Scancode; -const Config = struct { +pub const Config = struct { const RenderMode = enum { pixel, pixel_perfect, @@ -20,21 +20,34 @@ const Config = struct { title: [:0]const u8 = "ZXC", }; -const Keystate = enum { +pub const Keystate = enum { up, released, down, pressed, + + pub fn up(self: Keystate) bool { + return self == .up or self == .released; + } + pub fn released(self: Keystate) bool { + return self == .released; + } + pub fn down(self: Keystate) bool { + return self == .down or self == .pressed; + } + pub fn pressed(self: Keystate) bool { + return self == .pressed; + } }; -const Color = struct { +pub const Color = struct { r: ?f32 = null, g: ?f32 = null, b: ?f32 = null, a: ?f32 = null, }; -const Rectangle = struct { +pub const Rectangle = struct { x: i32, y: i32, w: u16, |