Hide the mouse when using the buttons

This commit is contained in:
Simon Cambier 2023-10-10 22:09:10 +02:00
parent 10191afb92
commit 7b256d0ef0
2 changed files with 15 additions and 2 deletions

View File

@ -93,6 +93,8 @@ function _init()
-- pal({[0]=0,128,132,7,136,8,14,137,9,10,131,3,11,1,140,12},1)
-- poke(0x5f2e,1) --to keep colors
poke(0x5F2D, 1)
printh(" ")
printh("*************")
printh(" ")
@ -101,6 +103,8 @@ function _init()
printh("seed " .. date)
frame_count = 0
draw_mouse = false
last_mouse_pos = { 0, 0 }
states = {
rules = state_rules(),
@ -116,9 +120,17 @@ end
function _update60()
frame_count += 1
if btnp() > 0 then
draw_mouse = false
end
-- update mouse coords
mouse_x = stat(32)
mouse_y = stat(33)
if mouse_x != last_mouse_pos[1] or mouse_y != last_mouse_pos[2] then
last_mouse_pos = { mouse_x, mouse_y }
draw_mouse = true
end
_coresolve()
gs._update()
@ -130,5 +142,7 @@ function _draw()
overlay:_draw()
end
-- mouse cursor
if draw_mouse then
spr(1, mouse_x, mouse_y)
end
end

View File

@ -41,7 +41,6 @@ function state_menu()
local function _enter()
-- mouse not bound to buttons
poke(0x5F2D, 1)
end
local function _draw()