Skip to content

MenuDef beta ​

Interface of @v12-engine/client/app

ts
export interface MenuDef extends Own<MenuProps>

A screen before or between games, as it is declared (menuScene makes the scene of it): a title and buttons, each going to a scene, or to the list of scenes with none. Each way takes more of it over than the last: - declared: its title, its buttons and where each goes, its background - in code: what a button does (run, given the way to other scenes) - a component in the place of the client's (MenuScreen, which it can wrap) - an element of the game's own (mount): any HTML, any framework

Members ​

background ​

ts
background?: string;

CSS for the background of the menu

behind ​

ts
behind?: GameScene<any> | {
        scene: GameScene<any>;
        loading?: LoadingLook;
    };

A game scene played behind the menu's buttons, the menu's background clear over it: a cinematic that loops (cinematicScene with a def's loop, then doing nothing), a fly-over of a map. It shows no loading screen: it eases in once the game is on. { scene, loading } gives it one of its own (LoadingLook). The app keeps it by the scene's id from menu to menu, asleep where no menu shows it: gone as a game opens, or after a minute unused

buttons ​

ts
buttons: MenuChoice[];

What each goes to, with what (args), or what it does (run, given the way to other scenes)

description ​

ts
description?: string;

A few words under the title: what the game is

details ​

ts
details?: {
        label: string;
        value: string;
    }[];

Facts about the game under them, each a label and its value: its version, its maps, how many play

id ​

ts
readonly id: string;

The menu's id, by which goTo opens it

music ​

ts
music?: string | readonly string[] | null;

Its music, by the addresses of its files, one after the other, over and over, through the app's mixer (ClientRuntime.mixer): crossfaded from what plays, and it goes on past the menu until a scene says otherwise; a game that plays the same files carries it on as it is. null fades out what plays; left out, what plays goes on. A game behind the menu (behind) starts none of its own under it

name ​

ts
name: string;

What the menu is called in the list of scenes and on loading screens

title ​

ts
title: string;

The heading shown over the menu, normally the game's name

transition ​

ts
transition?: SceneTransition;

How it comes in over the scene before (SceneTransition): as the app says when left out

warm ​

ts
warm?: readonly (string | SceneRef<any>)[];

Scenes to fetch ahead once the menu is drawn, by id or themselves (app.warm): their code and the files they start with, so that a button goes there at once