From c39ff632b46c179709101c5b50a061ebd723689f Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Sun, 26 Jan 2025 14:31:52 -0600 Subject: final commit --- src/ui.moon | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/ui.moon') diff --git a/src/ui.moon b/src/ui.moon index f729756..3c45b80 100644 --- a/src/ui.moon +++ b/src/ui.moon @@ -5,6 +5,7 @@ util = require("util") Button = require("ui.button") Joystick = require("ui.joystick") Textbox = require("ui.textbox") +Checkbox = require("ui.checkbox") ui_world = hc.new(64) @@ -32,6 +33,17 @@ ui.button = (x,y,width,height,text,controller_binds) -> ui.events.controller[bind] = button button +ui.checkbox = (x,y,width,height,text,controller_binds) -> + controller_binds = controller_binds or {} + checkbox = Checkbox(x,y,width,height,text) + ui.node\append(checkbox.node) + bounds = ui_world\rectangle(x,y,width,height) + ui.events.touch[bounds] = checkbox + ui.events.mouse[bounds] = checkbox + for bind in *controller_binds + ui.events.controller[bind] = checkbox + checkbox + ui.click = (x,y) -> ui_world\shapesAt(x,y) -- cgit v1.2.3-70-g09d2