summaryrefslogtreecommitdiff
path: root/src/ui.moon
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2025-01-12 22:45:37 -0600
committerAlexander M Pickering <alex@cogarr.net>2025-01-12 22:45:37 -0600
commit90ee66a3a6aae10fd84f3f43844db55229933e37 (patch)
treef723f918871c3296636ef2538a1a29a23050e520 /src/ui.moon
parentdecb72f936060a65bff18e9cbf33642ea3a71cd0 (diff)
downloadggj25-90ee66a3a6aae10fd84f3f43844db55229933e37.tar.gz
ggj25-90ee66a3a6aae10fd84f3f43844db55229933e37.tar.bz2
ggj25-90ee66a3a6aae10fd84f3f43844db55229933e37.zip
work
Diffstat (limited to 'src/ui.moon')
-rw-r--r--src/ui.moon6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ui.moon b/src/ui.moon
index 7a06522..4746302 100644
--- a/src/ui.moon
+++ b/src/ui.moon
@@ -1,5 +1,6 @@
hc = require("party.hardoncollider.init")
win = require("window")
+log = require("log")
Button = require("ui.button")
Joystick = require("ui.joystick")
Textbox = require("ui.textbox")
@@ -29,6 +30,7 @@ ui.joystick = (x,y,r) ->
ui.node\append(joystick.node)
bounds = ui_world\circle(x,y,r)
ui.events.touch[bounds] = joystick
+ joystick
ui.textbox = (x,y,width,height,value,placeholder) ->
value = value or ""
@@ -38,6 +40,7 @@ ui.textbox = (x,y,width,height,value,placeholder) ->
bounds = ui_world\rectangle(x,y,width,height)
ui.events.mouse[bounds] = textbox
ui.events.keyboard[textbox] = true
+ textbox
ui.node = am.group!
@@ -69,10 +72,13 @@ ui.node\action(() ->
match = ui.events.mouse[collider]
if match
has_fire(match)
+ --log.info("Found button under mouse:" .. tostring(match), {"ui","mouseover"})
match\fire(mo_tbl)
if down
+ log.info("Found button under mouse:" .. tostring(match), {"ui","mousedown"})
match\fire(md_tbl)
if up
+ log.info("Found button under mouse:" .. tostring(match), {"ui","mouseup"})
match\fire(mu_tbl)
if math.length(wheel) > 0
etbl =