From 9299b49184e2b47aacc5e1f49cbff9a6a1dbab97 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Fri, 22 Sep 2023 23:10:30 -0700 Subject: [PATCH] checkboxes work, might be labeled backwards --- bitplane-thingie.p8 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bitplane-thingie.p8 b/bitplane-thingie.p8 index 3cb643f..2ea83a4 100644 --- a/bitplane-thingie.p8 +++ b/bitplane-thingie.p8 @@ -137,6 +137,34 @@ function handle_ui_click(x, y) return end + -- checkboxes: qualify + if (y < 113 or y > 120 or x < 32) return + + if x <= 67 then + x -= 32 + if (x % 9 == 8) return + local box = x \ 9 + --check range + if (box < 0 or box > 3) return + toggle_mask_bit(box) + return + end + + x -= 90 + if (x % 9 == 8) return + local box = x \ 9 + --check range + if (box < 0 or box > 3) return + toggle_mask_bit(box + 4) + return +end + +function toggle_mask_bit(n) + local sel = 1 << n + local b = plane_mask & sel + plane_mask = plane_mask & ~sel + if (b > 0) return + plane_mask = plane_mask | sel end -->8 -- draw_cursor