From 28473bbe010fd5f3a52f34f7c230434c4bfd02d0 Mon Sep 17 00:00:00 2001 From: Marten Hildell Date: Sun, 14 Jun 2026 16:40:25 +0200 Subject: [PATCH] feat: expose WindowCfg.sample_count (MSAA) and forward to gg.new_context gg already supports MSAA via Config.sample_count (and new_context forwards it), but gui hard-codes the default (1 = off) with no way to enable it. Add a sample_count field to WindowCfg (default 1, so it's inert for existing apps) and pass it through to gg.new_context. With sample_count: 4, draw_canvas lines and polygons (e.g. real-time signal plots) render antialiased instead of jagged. --- window.v | 2 ++ 1 file changed, 2 insertions(+) diff --git a/window.v b/window.v index 45c8f54..479e497 100644 --- a/window.v +++ b/window.v @@ -103,6 +103,7 @@ pub: on_event fn (e &Event, mut w Window) = fn (_ &Event, mut _ Window) {} // global event hook; fires for all events log_level log.Level = default_log_level() debug_layout bool // print layout timing stats to stdout each frame + sample_count int = 1 // MSAA sample count (1 = off; 4 antialiases draw_canvas lines/polygons) } fn default_log_level() log.Level { @@ -131,6 +132,7 @@ pub fn window(cfg &WindowCfg) &Window { width: cfg.width height: cfg.height window_title: cfg.title + sample_count: cfg.sample_count event_fn: event_fn enable_dragndrop: cfg.dragndrop max_dropped_files: int(cfg.dragndrop_files_max)