Logo Mibo

AdaptiveProgram Module

Functions for creating and configuring adaptive programs.

Functions and values

Function or value Description

AdaptiveProgram.mkProgram init update

Full Usage: AdaptiveProgram.mkProgram init update

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Creates a new adaptive program with the given Init and Update functions.

This is the starting point for building an adaptive game, mirroring Program.mkProgram. The init function builds the dependency graph (roots and projections) and returns the frame builder; the update function is the per-frame imperative phase that reads projections and writes roots.

init : AdaptiveFrameContext -> AdaptiveInit<'Frame>

Builds the graph and returns the AdaptiveInit. Receives the AdaptiveFrameContext; work posted through its Intents member runs at the startup drain, before the first frame is forced.

update : AdaptiveContext -> GameTime -> unit

Per-frame phase: reads projections, writes roots, posts intents. Receives the full AdaptiveContext.

Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.observe onNext

Full Usage: AdaptiveProgram.observe onNext

Parameters:
Returns: IObserver<GameContext * 'Frame * GameTime>
Modifiers: inline
Type parameters: 'Frame

Creates a System.IObserver from an onNext callback, hiding the OnError and OnCompleted boilerplate.

onNext : GameContext * 'Frame * GameTime -> unit
Returns: IObserver<GameContext * 'Frame * GameTime>

AdaptiveProgram.withAssetsBasePath basePath program

Full Usage: AdaptiveProgram.withAssetsBasePath basePath program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Configures a base path for asset loading.

basePath : string
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withConfig configure program

Full Usage: AdaptiveProgram.withConfig configure program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Configure game settings (resolution, title, framerate). The callback receives the current GameConfig and returns a modified copy.

configure : GameConfig -> GameConfig
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withFixedStep cfg program

Full Usage: AdaptiveProgram.withFixedStep cfg program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Enables a framework-managed fixed timestep. When enabled, the runner converts the variable frame time into zero or more fixed-size steps per Step, running Update once per step (each followed by the post drain) and forcing the frame once at the end.

cfg : AdaptiveFixedStepConfig
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withInput program

Full Usage: AdaptiveProgram.withInput program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Enables the reactive input polling service.

Registers IInput in the GameContext service container and polls it once per frame before Update. Required for programs that read keyboard, mouse, touch, or gamepad input. Off by default — mirrors Program.withInput.

program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withObserver factory program

Full Usage: AdaptiveProgram.withObserver factory program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Adds an observer factory to the program. Observers receive the forced frame each step, in registration order.

factory : unit -> IObserver<GameContext * 'Frame * GameTime>
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withProfiler profiler program

Full Usage: AdaptiveProgram.withProfiler profiler program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Supplies the frame profiler the host registers and measures with.

Without it the host measures nothing. The profiler itself decides the measurement window and whether screenshots are possible; its Enabled property turns measurement on and off at runtime.

profiler : FrameProfiler
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withRenderer factory program

Full Usage: AdaptiveProgram.withRenderer factory program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Adds a renderer factory to the program. Renderers are called each frame to draw the forced frame, in registration order.

factory : unit -> IRenderer<'Frame>
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withServiceRegistration register program

Full Usage: AdaptiveProgram.withServiceRegistration register program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Appends a service-registration callback invoked by the windowed hosts after core services (assets, input) are registered but before Init.

register : GameContext -> unit
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

AdaptiveProgram.withUpdate update program

Full Usage: AdaptiveProgram.withUpdate update program

Parameters:
Returns: AdaptiveProgram<'Frame>
Modifiers: inline
Type parameters: 'Frame

Sets the per-frame phase of the program.

update : AdaptiveContext -> GameTime -> unit
program : AdaptiveProgram<'Frame>
Returns: AdaptiveProgram<'Frame>

Type something to start searching.