diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 14:31:52 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 14:31:52 -0600 |
| commit | c39ff632b46c179709101c5b50a061ebd723689f (patch) | |
| tree | 23060311477b996cd11c50851e7dfb889d339346 /src/ui.moon | |
| parent | c1030d5ddbf34b1b19fa7fd169f3cf5a7b7f98f3 (diff) | |
| download | ggj25-c39ff632b46c179709101c5b50a061ebd723689f.tar.gz ggj25-c39ff632b46c179709101c5b50a061ebd723689f.tar.bz2 ggj25-c39ff632b46c179709101c5b50a061ebd723689f.zip | |
final commit
Diffstat (limited to 'src/ui.moon')
| -rw-r--r-- | src/ui.moon | 12 |
1 files changed, 12 insertions, 0 deletions
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) |
