appMenu
The app's menu: the one menu the pause action opens (Escape, a gamepad's Start, the on-screen Menu button, a headset's left menu button), in every profile and on every platform. It is a host of tabs: every tab is a .menuTab asset that draws its own body, and the menu draws the frame around them in the presentation the device needs: full-window on a desktop, full-screen with the tabs along the bottom on a phone, and a home menu on a world panel in a headset, with the tabs along its bottom edge and Resume, Recenter and Exit VR along its top. The engine's own tabs are ZeroMind (the worlds to play and make) and System (the client settings); World is the world's own tab, the .menuTab in its /source, and while a world has none it shows the world's title and the way back to it. Opening the menu pauses nothing: every world is shared, and it keeps running.
require("@builtin::modules.api.engine.app_menu") -- appMenu (also available as global 'appMenu')
The appMenu namespace: 29 functions.
globals/appMenu/SCREEN
appMenu.SCREEN()
The id of the menu's screen and of its world panel in a headset.
globals/appMenu/activeTab
appMenu.activeTab() -> string?
The tab the menu shows, or would show when opened.
Returns string?
globals/appMenu/close
appMenu.close(opts: { force: boolean? }?) -> boolean
Close the menu and go back to the world it was opened over. A menu
with no world behind it stays, unless force takes it down regardless,
as opening a world from it does.
Parameters
opts{ force: boolean? }(optional) —{ force? }.
Returns boolean — Whether it closed.
globals/appMenu/isOpen
appMenu.isOpen() -> boolean
Whether the menu is open.
Returns boolean
globals/appMenu/open
appMenu.open(tab: string?)
Open the menu, on the tab named or the one shown last.
Parameters
tabstring(optional) — The tab's id ("world","zeromind","system"), or nil.
globals/appMenu/presentation
appMenu.presentation() -> Presentation
The presentation the menu is drawn in on this client now: "vr"
while a headset session holds focus, "phone" on Android and on a
screen narrower than a tablet or standing in portrait, "desktop"
otherwise.
Returns Presentation — The presentation.
globals/appMenu/redraw
appMenu.redraw()
Draw the open menu again, its frame and the shown tab's body built
from their state now. A tab calls it after its own state changes, in
its onCallback or from a task or a timer, for the change to show; a
closed menu builds the tab it shows afresh when it next opens.
globals/appMenu/select
appMenu.select(tab: string)
Show the tab named in the open menu.
Parameters
tabstring— The tab's id.
globals/appMenu/tabs
appMenu.tabs() -> { { id: string, title: string, visible: boolean } }
The tabs registered, in their order, and whether each shows now.
Returns { { id: string, title: string, visible: boolean } } — { { id, title, visible } }.
globals/appMenu/toggle
appMenu.toggle()
What the pause action does: open the menu, or, while it is open, go back one step in its tab, and close it from the tab's first step.
modules/appMenu/activeTab
activeTab(): string?
The tab the menu shows, or would show when opened.
modules/appMenu/close
close(opts: { force: boolean? }?): boolean
Close the menu and go back to the world it was opened over. A menu
with no world behind it stays, unless force takes it down regardless,
as opening a world from it does.
Parameters
opts{ force: boolean? }?(optional) —{ force? }.
modules/appMenu/install
install()
Hold the pause action and keep the open menu in its presentation and current with the window. Called once by the prelude.
modules/appMenu/isOpen
isOpen(): boolean
Whether the menu is open.
modules/appMenu/open
open(tab: string?)
Open the menu, on the tab named or the one shown last.
Parameters
tabstring?(optional) — The tab's id ("world","zeromind","system"), or nil.
modules/appMenu/presentation
presentation(): Presentation
The presentation the menu is drawn in on this client now: "vr"
while a headset session holds focus, "phone" on Android and on a
screen narrower than a tablet or standing in portrait, "desktop"
otherwise.
modules/appMenu/redraw
redraw()
Draw the open menu again, its frame and the shown tab's body built
from their state now. A tab calls it after its own state changes, in
its onCallback or from a task or a timer, for the change to show; a
closed menu builds the tab it shows afresh when it next opens.
modules/appMenu/select
select(tab: string)
Show the tab named in the open menu.
Parameters
tabstring— The tab's id.
modules/appMenu/tabs
tabs(): { { id: string, title: string, visible: boolean } }
The tabs registered, in their order, and whether each shows now.
modules/appMenu/toggle
toggle()
What the pause action does: open the menu, or, while it is open, go back one step in its tab, and close it from the tab's first step.
typed/builtin//modules/api/engine/app_menu/appMenu/activeTab
appMenu.activeTab() -> string?
The tab the menu shows, or would show when opened.
Returns string?
typed/builtin//modules/api/engine/app_menu/appMenu/close
appMenu.close(opts: { force: boolean? }?) -> boolean
Close the menu and go back to the world it was opened over. A menu
with no world behind it stays, unless force takes it down regardless,
as opening a world from it does.
Parameters
opts{ force: boolean? }(optional) —{ force? }.
Returns boolean — Whether it closed.
typed/builtin//modules/api/engine/app_menu/appMenu/isOpen
appMenu.isOpen() -> boolean
Whether the menu is open.
Returns boolean
typed/builtin//modules/api/engine/app_menu/appMenu/open
appMenu.open(tab: string?)
Open the menu, on the tab named or the one shown last.
Parameters
tabstring(optional) — The tab's id ("world","zeromind","system"), or nil.
typed/builtin//modules/api/engine/app_menu/appMenu/presentation
appMenu.presentation() -> Presentation
The presentation the menu is drawn in on this client now: "vr"
while a headset session holds focus, "phone" on Android and on a
screen narrower than a tablet or standing in portrait, "desktop"
otherwise.
Returns Presentation — The presentation.
typed/builtin//modules/api/engine/app_menu/appMenu/redraw
appMenu.redraw()
Draw the open menu again, its frame and the shown tab's body built
from their state now. A tab calls it after its own state changes, in
its onCallback or from a task or a timer, for the change to show; a
closed menu builds the tab it shows afresh when it next opens.
typed/builtin//modules/api/engine/app_menu/appMenu/select
appMenu.select(tab: string)
Show the tab named in the open menu.
Parameters
tabstring— The tab's id.
typed/builtin//modules/api/engine/app_menu/appMenu/tabs
appMenu.tabs() -> { { id: string, title: string, visible: boolean } }
The tabs registered, in their order, and whether each shows now.
Returns { { id: string, title: string, visible: boolean } } — { { id, title, visible } }.
typed/builtin//modules/api/engine/app_menu/appMenu/toggle
appMenu.toggle()
What the pause action does: open the menu, or, while it is open, go back one step in its tab, and close it from the tab's first step.