#About kit.menu
The kit.menu module of LumaKit gives you entries in the game's pause menu. (A mod's settings are its luma.json options on the Mods page, read with option and on option: a setting is an option, not a menu entry.).
To use the module, add lumakit to the needs of your mod's luma.json and write:
use kit.menu#How the module works
Entries in the game's pause menu. While the pause menu is open (PauseMenu::appear to PauseMenu::kill) the entries that are on show as the game's own buttons: each pair of rows is a screen of the game's PauseMenu layout with everything hidden but its two buttons (NBackUp, NBackDown), their text the entries' labels, as Nebula's Settings button is made from the same layout. The game's Back and Quit move up and shrink to make room; the rows stand under them at the Settings button's size, two columns of two. Past four a page shows ▲ first and ▼ last to page through them; at most ten entries in all (most; one more is not added, logged). Order: the Mods list's order (top first), then each mod's in the order made. The rows join the game's own menu highlight beside Back and Quit (ui.share_rows); the pad, pointer and touch reach them as the game's buttons. The button with the highlight lights as the game's (ButtonSelectIn, ButtonSelectOut on its own pane); one taken plays the game's decide and its function runs when that ends, at a frame's start. Disabled entries are never highlighted or taken. Everything belongs to the mod that added it.
The module's source is lumakit/source/menu.lum.
#Declarations
| Name | Kind | Description |
|---|---|---|
Entry |
Struct | An entry's handle: its number, 0 for none. Its functions are also module functions (menu.set_label(e, s)). |
add_pause_entry |
Function | |
set_label |
Function | |
enable |
Function | |
remove |
Function | |
alive |
Function | |
close_pause |
Function |
#Entry
pub struct Entry {
id: u32
fn set_label(self, s: text) { set_label(self, s) }
fn enable(self, is_on: bool) { enable(self, is_on) }
fn remove(self) { remove(self) }
fn alive(self) -> bool { return alive(self) }
}An entry's handle: its number, 0 for none. Its functions are also module functions (menu.set_label(e, s)).
#add_pause_entry
pub fn add_pause_entry(label: text, on_choose: fn()) -> Entry#set_label
pub fn set_label(e: Entry, s: text)#enable
pub fn enable(e: Entry, is_on: bool)#remove
pub fn remove(e: Entry)#alive
pub fn alive(e: Entry) -> bool#close_pause
pub fn close_pause()