- [NEW] 'app' module

- [NEW] 'editor' module
- [NEW] 'msgbox' module
- [NEW] 'score' module
- [NEW] 'ui' module
- [NEW] 'util' module
This commit is contained in:
2025-06-20 13:50:07 +02:00
parent bbbf9d0c50
commit ddebcfa47a
11 changed files with 400 additions and 48 deletions

View File

@@ -21,22 +21,39 @@ menu = {
draw.rectf(0,0,160,7,23)
draw.hline(0,7,160,16)
menu.current_x = 1
menu.option("FILE")
popup.create("FILE", 1, 8)
popup.addOption("FILE", "New", function() sys.quit() end)
popup.addOption("FILE", "Load", function() sys.quit() end)
popup.addOption("FILE", "Save", function() sys.quit() end)
popup.addOption("FILE", "Save As...", function() sys.quit() end)
popup.addOption("FILE", "Save", function() rooms.save() editor.modified=false end)
popup.addOption("FILE", "Quit", editor.quit)
menu.option("VIEW")
popup.create("VIEW", 1, 8)
popup.addOption("VIEW", "Background", function() rooms.toggle_visibility(LAYER_BACKGROUND) end)
popup.addOption("VIEW", "Shadows", function() rooms.toggle_visibility(LAYER_SHADOWS) end)
popup.addOption("VIEW", "Foreground", function() rooms.toggle_visibility(LAYER_FOREGROUND) end)
popup.addOption("VIEW", "Sprites", function() rooms.toggle_visibility(LAYER_SPRITES) end)
menu.option("EDIT")
popup.create("EDIT", 1, 8)
popup.addOption("EDIT", "Background", function() editor.layer=LAYER_BACKGROUND end)
popup.addOption("EDIT", "Foreground", function() editor.layer=LAYER_FOREGROUND end)
--popup.addOption("EDIT", "Sprites", function() rooms.toggle_visibility(LAYER_SPRITES) end)
menu.option("TOOLS")
if editor.modified then
draw.text("*",160-5,1,8)
end
end,
option = function(label)
local next_x = menu.current_x + (#label + 2)*4
local mx, my = mouse.pos()
if my < 8 and mx >= menu.current_x and mx < next_x then
draw.rectf(menu.current_x, 0, next_x-menu.current_x, 8, 21)
draw.rectf(menu.current_x, 0, next_x-menu.current_x, 7, 21)
if mouse.down(mouse.LEFT) then
mouse.discard()
popup.show(label)
end
end