From df5c8e46a365f3de168ee05bd91dbf71a8ff09c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Sat, 15 Jan 2022 10:50:40 +0700 Subject: Port to Zig 0.9 --- src/main.zig | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 6cbf240..f861b19 100644 --- a/src/main.zig +++ b/src/main.zig @@ -37,38 +37,43 @@ var game: *c.Game = undefined; var prng: DefaultPrng = undefined; fn resizeWindow(window: gf.Window, width: c_int, height: c_int) void { + _ = window; c.resizeWindow(game, width, height); } fn handleKey(window: gf.Window, key: gf.Key, scancode: c_int, action: gf.KeyAction, mods: gf.Mods) void { + _ = window; + _ = scancode; c.handleKey(game, @enumToInt(key), @enumToInt(action), mods.toInt()); } fn look(window: gf.Window, xpos: f64, ypos: f64) void { + _ = window; c.look(game, xpos, ypos); } fn click(window: gf.Window, button: gf.MouseButton, action: gf.MouseButton.Action, mods: gf.Mods) void { + _ = window; c.click(game, @enumToInt(button), @enumToInt(action), mods.toInt()); } /// Return a floating point value evenly distributed in the range [0, 1). export fn randFloat() f32 { - return prng.random.float(f32); + return prng.random().float(f32); } /// Return a random integer i where at_least <= i <= at_most. /// The results of this function may be biased. export fn randInt(at_least: i32, at_most: i32) i32 { - return prng.random.intRangeAtMostBiased(i32, at_least, at_most); + return prng.random().intRangeAtMostBiased(i32, at_least, at_most); } /// Return a random integer i where 0 <= i < less_than. /// The results of this function may be biased. export fn randUint(less_than: u32) u32 { - return prng.random.uintLessThanBiased(u32, less_than); + return prng.random().uintLessThanBiased(u32, less_than); } pub fn main() !void { -- cgit v1.2.3