Logo Mibo

RaylibProgram Module

Raylib-specific Program builder extensions.

Types

Type Description

BankEntry

One entry of a sound bank: a game-vocabulary key bound to the file that plays under it. The whole bank loads before user init runs.

Functions and values

Function or value Description

withBank bank program

Full Usage: withBank bank program

Parameters:
Returns: Program<'Model, 'Msg>
Type parameters: 'Model, 'Msg

Configures the game's sound bank: every entry loads before user init runs, so Audio.play/Audio.playMusic can start sounds from the very first message.

The bank is an ordinary F# value: a list literal for small games, or a generated value for large ones (a naming convention, a manifest, a directory scan). List order is load order. One call configures the whole bank; there are no per-asset builder calls.

Each entry becomes a registration callback that runs where every other service registration runs — after the host registers its services, before Init. Keys are game vocabulary ("jump", "overworld"); a key registered twice keeps the first entry.

bank : BankEntry list
program : Program<'Model, 'Msg>
Returns: Program<'Model, 'Msg>
Example

 let program =
   mkProgram init update
   |> RaylibProgram.withBank
     [ Sound("jump", "assets/jump.wav")
       Music("overworld", "assets/overworld.ogg") ]
val program: obj

withInputMapper initialMap program

Full Usage: withInputMapper initialMap program

Parameters:
Returns: Program<'Model, 'Msg>
Type parameters: 'Model, 'Msg, 'Action (requires comparison)

Configures the game to register an IInputMapper service backed by raylib's polling API.

This registers IInput automatically (equivalent to Program.withInput).

The mapper is registered as a service via a Program.ServiceRegistrations callback that the runtime host runs before Init, so the Core Program type does not reference the raylib factory directly.

The service is registered, not driven: nothing polls Update() automatically — call it yourself each frame if you read CurrentState, or prefer the subscription path below, which the input deltas drive on their own.

If you want to stay fully "Elmish" (no service access), consider using InputMapper.subscribe instead and handle a single message (adaptive programs: InputMapper.subscribeAdaptive).

initialMap : InputMap<'Action>
program : Program<'Model, 'Msg>
Returns: Program<'Model, 'Msg>
Example

 program |> RaylibProgram.withInputMapper inputMap

Type something to start searching.