Interface
: BUILDNANA configurations.
?: number Height of game.
?: number Pixel scale / size.
?: boolean Keep aspect ratio and leave black bars on remaining spaces.
?: boolean If register debug buttons (default true)
?: Key Key that toggles debug mode
?: string Default font (defaults to "monospace").
?: number Device pixel scale (defaults to 1, high pixel density will hurt performance).
?: boolean Disable antialias and enable sharp pixel display. If you see rendering artifacts, set pixelDensity
param to Math.min(devicePixelRatio, 2) and scale to FHD resolution (e.g. 960x540 would need scale 2). Will result in up to 4K.
?: HTMLCanvasElement The canvas DOM element to use. If empty will create one.
?: HTMLElement The container DOM element to insert the canvas if created. Defaults to document.body.
?: RGBValue | RGBAValue | string Background color. E.g. [ 0, 0, 255 ] for solid blue background, or [ 0, 0, 0, 0 ] for transparent background. Accepts RGB value array or string hex codes.
?: TexFilter Default sprite texture filter.
?: TexFilter Default text rasterization filter.
default "linear" for vector fonts (.woff2, .ttf, .otf, etc)
"nearest" for bitmap fonts (loaded from an image)
?: number How many log messages can there be on one screen (default 8).
?: number How many seconds log messages stay on screen (default 4).
?: number Size of the spatial hash grid for collision detection (default 64).
?: boolean If translate touch events as mouse clicks (default true).
?: boolean If BUILDNANA should render a default loading screen when assets are not fully ready (default true).
?: boolean If pause audio when tab is not active (default false).
?: Record<string, GamepadDef> Custom gamepad definitions (see gamepad.json for reference of the format).
?: ButtonsDef Defined buttons for input binding.
?: number Limit framerate to an amount per second.
?: FixedSpeedOption The number of fixedUpdate() events that should happen per second.
The fixedUpdate() loop is used for physics.
The average user should never need to change this. If you set it too low
then your physics will freak out due to numerical instability. If you set it too high then
the game will lag.
The options are:
* friedPotato: 10Hz
* potato: 20Hz
* snail: 25Hz
* normal: 50Hz (default)
* lightspeed: 80Hz
* ridiculous: 125Hz
* ludicrous: 160Hz
group Physics
experimental
?: number The maximum amount of time the game will simulate passing in order to
limit lag. If the framerate lags low enough that one frame takes
longer than this time, the game will instead use this as the delta time
value, which means that the game will run slower than 100% speed.
The average user should never need to change this. If you set it too
low, the game will slow down with even the slightest lag, and if you
set it too high then the game could try to do too much on each frame
and amplify the lag problem.
default 0.1
group Physics
experimental
?: boolean If focus on the canvas on start (default true).
?: boolean If import all BUILDNANA functions to global (default true).
?: PluginList<any> List of plugins to import.
?: boolean Enter burp mode.
?: boolean Make components ids be added as tags.
That means .is() will return true for components with that id.
?: number Padding used when adding sprites to texture atlas.
?: boolean If the debug inspect view should ignore objects that are paused when choosing
the object to show the inspect view on.
default false
experimental
?: BroadPhaseType Which strategy to use for broad phase collision, sap, sapv or quadtree
?: NarrowPhaseType Which strategy to use for narrow phase collision, gjk, sat or box
?: boolean If true, only the topmost object receives clicks
?: number Timeout (in milliseconds) at which other loaders waiting on sprites will give
up and throw an error.
Currently this is only used by .
?: "scene" | "app" The default lifetime scope used for event handlers.
?: TypesOpt TypeScript Advanced Features (TAF) are a series of options for TypeScript
only features.
It should be created using the helper function buildnanaTypes.
ts
buildnana({
types: buildnanaTypes>();
});
?: RNGConfig Random generator to be used by the game.
You can select one of the three built-in random generators: "lce", "xorshift32", or "alea".
The default is the linear congruential engine, "lce".
To pass a custom seed, use an RNGConfig object:
```ts
buildnana({
rng: {
type: "alea",
seed: ["buildnana", "rocks", "hard"],
},
});
```
When using the Alea algorithm, provide three string seeds to ensure good entropy.
You can also use a custom generator that satisfies the `RandomGenerator` interface.
since v4000.0