pancelor / p8x8

convert PICO-8 carts into picotron carts (some assembly required)
Other
20 stars 0 forks source link

pausing the game #7

Closed pancelor closed 5 months ago

pancelor commented 5 months ago

it's not currently possible to pause converted carts. some simple solution would be nice (configurable behavior to either never pause, or pause on focus lost?)

note: menuitem does work (in the menu in the top-left)

pancelor commented 4 months ago

configurable behavior to either never pause, or pause on focus lost?)

done

however, it would still be nice to be able to pause by pressing escape. in particular it's awkward that opening the app menu (where the pause options are) doesn't count as focus lost

I don't see any events that can tell me when the menu is opened -- tested with this code:

function on_event_pqn(ev_name, fn)
    fn = fn or min
    on_event(ev_name,function(msg)
        pqn(ev_name,msg)
        fn(msg)
    end)
end

on_event_pqn("gained_focus")
on_event_pqn("lost_focus")
on_event_pqn("menu_action")
on_event_pqn("toggle_app_menu")
on_event_pqn("app_menu_item")
window{title="hi",width=w,height=h}
menuitem{
    id="foo",
    label="hello",
    action=function()end,
}