Compare commits

...

2 Commits

Author SHA1 Message Date
9467d72fbb - Ja es pot triar tile a l'editor 2023-01-27 20:00:53 +01:00
2d82e95373 - els menus es poden controlar amb el ratolí 2023-01-27 20:00:37 +01:00
2 changed files with 33 additions and 0 deletions

View File

@@ -42,6 +42,30 @@ editor={
editor.paused=true
editor.show_menu()
end
if btnp(KEY_TAB) then
update=editor.update_tileset
end
end
end,
update_tileset=function()
cls()
sspr(0,0,128,128,0,0)
local mx,my=mousex(),mousey()
local tx,ty=mx>>3,my>>3
local rx,ry=tx<<3,ty<<3
rect(rx-1, ry-1, rx+8, ry+8, 10)
if btnp(KEY_TAB) or btnp(KEY_ESCAPE) then
update=editor.update
end
if mbtnp(1) then
if tx<16 and ty<16 then
editor.selected_tile=ty*16+tx
end
update=editor.update
end
end,

View File

@@ -28,6 +28,15 @@ menu = {
if menu.selected==0 then menu.selected=#menu.options end
if menu.selected>#menu.options then menu.selected=1 end
local mx,my=mousex(),mousey()
if mx>=20 and mx<=140 and my>=28 and my<=(28+#menu.options*10) then
menu.selected=min(1+flr((my-28)/10),#menu.options)
if mbtnp(1) then
update=menu.old_update
menu.options[menu.selected][2]()
end
end
if btnp(KEY_RETURN) then
update=menu.old_update
menu.options[menu.selected][2]()