From a2f38877b64701c8c5192e951ffc74337f501379 Mon Sep 17 00:00:00 2001 From: nothke Date: Sun, 9 Jun 2024 19:56:09 +0200 Subject: [PATCH] Flashy green --- src/main.zig | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main.zig b/src/main.zig index 1516d5f..3bdb8d6 100644 --- a/src/main.zig +++ b/src/main.zig @@ -16,16 +16,24 @@ export fn init() void { .environment = sokol.glue.environment(), }); + sokol.time.setup(); + pass_action.colors[0] = .{ .load_action = .CLEAR, - .clear_value = .{ .r = 0.2, .g = 1, .b = 1, .a = 1 }, + .clear_value = .{ .r = 0, .g = 1, .b = 0, .a = 1 }, }; - std.debug.print("Backend: {}\n", .{sg.queryBackend()}); + std.log.info("Backend: {}\n", .{sg.queryBackend()}); +} + +fn timef() f32 { + return @as(f32, @floatCast(sokol.time.sec(sokol.time.now()))); } export fn frame() void { - //const g = pass_action.colors[0].clear_value.g + 0.01; + //std.log.info("{}", .{sokol.time.now()}); + + pass_action.colors[0].clear_value.g = @abs(@sin(timef())); sg.beginPass(.{ .action = pass_action, .swapchain = sokol.glue.swapchain() }); sg.endPass();