From 6cdc7646b8342d294994a0b75c6b7599785936a9 Mon Sep 17 00:00:00 2001 From: KJ Lawrence Date: Thu, 27 May 2021 10:56:18 -0400 Subject: [PATCH] gg: add quit fn (#10223) --- vlib/gg/gg.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index 127789e36b..c1201223f0 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -359,6 +359,11 @@ pub fn (gg &Context) run() { sapp.run(&gg.window) } +// quit closes the context window and exits the event loop for it +pub fn (ctx &Context) quit() { + sapp.request_quit() // does not require ctx right now, but sokol multi-window might in the future +} + pub fn (mut ctx Context) set_bg_color(c gx.Color) { ctx.clear_pass = gfx.create_clear_pass(f32(c.r) / 255.0, f32(c.g) / 255.0, f32(c.b) / 255.0, f32(c.a) / 255.0)