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) -- 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(0x5f2e,1) --to keep colors
poke(0x5F2D, 1)
printh(" ") printh(" ")
printh("*************") printh("*************")
printh(" ") printh(" ")
@ -101,6 +103,8 @@ function _init()
printh("seed " .. date) printh("seed " .. date)
frame_count = 0 frame_count = 0
draw_mouse = false
last_mouse_pos = { 0, 0 }
states = { states = {
rules = state_rules(), rules = state_rules(),
@ -116,9 +120,17 @@ end
function _update60() function _update60()
frame_count += 1 frame_count += 1
if btnp() > 0 then
draw_mouse = false
end
-- update mouse coords -- update mouse coords
mouse_x = stat(32) mouse_x = stat(32)
mouse_y = stat(33) 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() _coresolve()
gs._update() gs._update()
@ -130,5 +142,7 @@ function _draw()
overlay:_draw() overlay:_draw()
end end
-- mouse cursor -- mouse cursor
spr(1, mouse_x, mouse_y) if draw_mouse then
spr(1, mouse_x, mouse_y)
end
end end

View File

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