summaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2026-05-09 18:38:21 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2026-05-09 18:38:21 -0700
commiteb9466c8d3d18d65eb4bab2f6770f55cba9d8de3 (patch)
treebd2c49b56d9a4bdc30e3aec5ad0b3139b398c566 /util.lua
parent78fd742b1e276aec3eb1e939542ef51c3231b060 (diff)
downloaddyl8-eb9466c8d3d18d65eb4bab2f6770f55cba9d8de3.tar.gz
dyl8-eb9466c8d3d18d65eb4bab2f6770f55cba9d8de3.zip
Adding a simple grid-based camera
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util.lua b/util.lua
index 5d31a2a..5fd41d3 100644
--- a/util.lua
+++ b/util.lua
@@ -1,5 +1,9 @@
update_hooks = {}
+function AddUpdateHook(f)
+ update_hooks[#update_hooks + 1] = f
+end
+
-- https://pico-8.fandom.com/wiki/Qsort
function qsort(a, c, l, r)
c, l, r = c or function(a, b) return a < b end, l or 1, r or #a
@@ -99,7 +103,7 @@ function _update_button_states(_dt)
end
end
end
-update_hooks[1] = _update_button_states
+AddUpdateHook(_update_button_states)
function button_just_pressed(id)
return _button_states[id] == "just_pressed"
end \ No newline at end of file