const std = @import("std"); const sokol = @import("sokol"); const sg = sokol.gfx; const state = struct { var bind: sg.Bindings = .{}; var pip: sg.Pipeline = .{}; }; var pass_action: sg.PassAction = .{}; export fn init() void { sg.setup(.{ .logger = .{ .func = sokol.log.func }, .environment = sokol.glue.environment(), }); sokol.time.setup(); pass_action.colors[0] = .{ .load_action = .CLEAR, .clear_value = .{ .r = 0, .g = 1, .b = 0, .a = 1 }, }; std.log.info("Backend: {}\n", .{sg.queryBackend()}); } fn timef() f32 { return @as(f32, @floatCast(sokol.time.sec(sokol.time.now()))); } export fn frame() void { //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(); sg.commit(); } export fn cleanup() void {} pub fn main() !void { sokol.app.run(.{ .init_cb = init, .frame_cb = frame, .cleanup_cb = cleanup, .width = 800, .height = 600, .icon = .{ .sokol_default = true }, .window_title = "sokol hello", .logger = .{ .func = sokol.log.func }, }); }