Logo Mibo

Program<'Model, 'Msg> Type

The Elmish program record that defines the complete game architecture.

A program ties together initialization, update logic, subscriptions, and rendering. Use the Program module functions to construct and configure programs.

Record fields

Record Field Description

AssetsBasePath

Full Usage: AssetsBasePath

Field type: string voption

Optional base path for asset loading. Set via Program.withAssetsBasePath.

Field type: string voption

Config

Full Usage: Config

Field type: (GameConfig -> GameConfig) list

List of configuration callbacks that transform the default GameConfig.

Each callback receives current config and returns a modified copy.

Field type: (GameConfig -> GameConfig) list

DispatchMode

Full Usage: DispatchMode

Field type: DispatchMode

Controls when dispatched messages become eligible for processing.

See DispatchMode.

Field type: DispatchMode

FixedStep

Full Usage: FixedStep

Field type: FixedStepConfig<'Msg> voption

Optional framework-managed fixed timestep configuration.

Field type: FixedStepConfig<'Msg> voption

HasInput

Full Usage: HasInput

Field type: bool

Whether the input service is enabled. Set via Program.withInput.

Field type: bool

HasInputMapper

Full Usage: HasInputMapper

Field type: bool

Whether an input mapper service is enabled. Set via a backend-specific withInputMapper function (e.g. RaylibProgram.withInputMapper).

Field type: bool

Init

Full Usage: Init

Field type: GameContext -> 'Model * Cmd<'Msg>

Creates initial model and commands when the game starts.

Field type: GameContext -> 'Model * Cmd<'Msg>

Profiler

Full Usage: Profiler

Field type: FrameProfiler voption

Optional frame profiler. Set via Program.withProfiler.

When unset, the host measures nothing.

Field type: FrameProfiler voption

Renderers

Full Usage: Renderers

Field type: (unit -> IRenderer<'Model>) list

List of renderer factories for drawing.

Field type: (unit -> IRenderer<'Model>) list

ServiceRegistrations

Full Usage: ServiceRegistrations

Field type: (GameContext -> unit) list

Service-registration callbacks invoked by the runtime host after core services (assets, input) are registered but before Program.Init.

Used by backend-specific builder functions (e.g. withInputMapper) to register backend-specific services without the Core Program builder referencing a backend factory directly.

Field type: (GameContext -> unit) list

Subscribe

Full Usage: Subscribe

Field type: GameContext -> 'Model -> Sub<'Msg>

Returns subscriptions based on current model state.

Field type: GameContext -> 'Model -> Sub<'Msg>

Tick

Full Usage: Tick

Field type: (GameTime -> 'Msg) voption

Optional function to generate a message each frame.

Field type: (GameTime -> 'Msg) voption

Update

Full Usage: Update

Field type: 'Msg -> 'Model -> 'Model * Cmd<'Msg>

Handles messages and returns updated model and commands.

Field type: 'Msg -> 'Model -> 'Model * Cmd<'Msg>

UpdateCtx

Full Usage: UpdateCtx

Field type: (GameContext -> 'Msg -> 'Model -> 'Model * Cmd<'Msg>) voption

Optional context-aware update. When set, the runtime calls this instead of Program, passing the same GameContext that Init, Subscribe, and the renderer callbacks already receive.

Set via Program.mkProgramCtx or Program.withUpdateCtx.

Field type: (GameContext -> 'Msg -> 'Model -> 'Model * Cmd<'Msg>) voption

Type something to start searching.