Header menu logo Mibo

Assets Module

Friendly GameContext-based accessors for the built-in IAssets service.

These functions assume Program.withAssets has been applied.

Functions and values

Function or value Description

create key factory ctx

Full Usage: create key factory ctx

Parameters:
Returns: 'T
key : string
factory : GraphicsDevice -> 'T
ctx : GameContext
Returns: 'T

effect path ctx

Full Usage: effect path ctx

Parameters:
Returns: Effect
path : string
ctx : GameContext
Returns: Effect

font path ctx

Full Usage: font path ctx

Parameters:
Returns: SpriteFont
path : string
ctx : GameContext
Returns: SpriteFont

fromCustom path loader _ctx

Full Usage: fromCustom path loader _ctx

Parameters:
    path : string
    loader : string -> 'T
    _ctx : GameContext

Returns: 'T

Load an asset using a custom loader function.

The loader receives the file path and should return the loaded asset.

path : string
loader : string -> 'T
_ctx : GameContext
Returns: 'T

fromCustomCache path loader ctx

Full Usage: fromCustomCache path loader ctx

Parameters:
    path : string
    loader : string -> 'T
    ctx : GameContext

Returns: 'T

Load an asset using a custom loader with caching (game-lifetime).

path : string
loader : string -> 'T
ctx : GameContext
Returns: 'T

fromJson path decoder

Full Usage: fromJson path decoder

Parameters:
    path : string
    decoder : Decoder<'T>

Returns: 'T

Load a JSON file and decode it using the provided JDeck decoder.

Reads from the Content directory (uses TitleContainer).

path : string
decoder : Decoder<'T>
Returns: 'T

fromJsonCache path decoder ctx

Full Usage: fromJsonCache path decoder ctx

Parameters:
    path : string
    decoder : Decoder<'T>
    ctx : GameContext

Returns: 'T

Load a JSON file with caching (game-lifetime).

On first call, decodes and caches; subsequent calls return cached value.

path : string
decoder : Decoder<'T>
ctx : GameContext
Returns: 'T

get key ctx

Full Usage: get key ctx

Parameters:
Returns: 'T voption
key : string
ctx : GameContext
Returns: 'T voption

getOrCreate key factory ctx

Full Usage: getOrCreate key factory ctx

Parameters:
Returns: 'T
key : string
factory : GraphicsDevice -> 'T
ctx : GameContext
Returns: 'T

getService ctx

Full Usage: getService ctx

Parameters:
Returns: IAssets
ctx : GameContext
Returns: IAssets

model path ctx

Full Usage: model path ctx

Parameters:
Returns: Model
path : string
ctx : GameContext
Returns: Model

sound path ctx

Full Usage: sound path ctx

Parameters:
Returns: SoundEffect
path : string
ctx : GameContext
Returns: SoundEffect

texture path ctx

Full Usage: texture path ctx

Parameters:
Returns: Texture2D
path : string
ctx : GameContext
Returns: Texture2D

tryGetService ctx

Full Usage: tryGetService ctx

Parameters:
Returns: IAssets voption
ctx : GameContext
Returns: IAssets voption

Type something to start searching.