Remarks
ExtendsNanoforgeApplication with client-specific library slots for
graphics, input, and sound, and owns the viewport (design resolution,
fit mode and window-resize tracking) exposed on Context.viewport.
Create an instance via NanoforgeFactory.createClient.
Example
Extends
NanoforgeApplication
Properties
viewport?
Defined in: nanoforge-application.ts:44 Client-only viewport, created byprotectedoptionalviewport?:InternalViewportState
NanoforgeClient.init before initialize.
Inherited from
NanoforgeApplication.viewport
Methods
init()
init(Defined in: nanoforge-client.ts:51 Initialise all registered libraries in dependency order and prepare the engine for the game loop.options):Promise<void>
Parameters
options
ClientRunOptions
Run options providing the canvas container, files map, and
environment variables.
Returns
Promise<void>
Remarks
Must be called beforerun. Resolves once every library’s __init
hook has completed.
initialize()
Defined in: nanoforge-application.ts:138protectedinitialize(options):Promise<void>
Parameters
options
RunOptions | ClientRunOptions
Returns
Promise<void>
Inherited from
NanoforgeApplication.initialize
run()
run():Defined in: nanoforge-application.ts:77 Start the game loop.Promise<void>
Returns
Promise<void>
Remarks
Must be called afterinit has resolved.
Throws
NfNotInitializedException When called before init.
Inherited from
NanoforgeApplication.run
schedule()
Defined in: nanoforge-application.ts:133 Callprotectedschedule(tick,delayMs):void
tick once delayMs elapsed: the next tick of the game loop.
Parameters
tick
() =>void
Next tick of the game loop.
delayMs
number
Delay before it, in milliseconds.
Returns
void
Inherited from
NanoforgeApplication.schedule
use()
use<Defined in: nanoforge-application.ts:64 Registers a library. Single argument — the library owns its own context key (seeL>(library):void
defineLibraryKey).
Type Parameters
L
L extends Library
Parameters
library
L
Library instance to register.
Returns
void
Throws
NfDuplicateLibraryException If the key is already registered or reserved ("app", "vars", "assets").
Inherited from
NanoforgeApplication.use