IAssets Type
Per-game asset loader/cache service.
Provides cached loading for textures, fonts, sounds, models, and shaders from loose files (no content pipeline). Also supports generic typed cache for custom asset types.
Example
let assets = GameContext.getService<IAssets> ctx
let tex = assets.Texture "sprites/player.png"
let font = assets.Font "fonts/main.ttf"
let config = assets.GetOrCreate "gameConfig" (fun () -> loadConfig())
Instance members
| Instance member |
Description
|
Full Usage:
this.Clear
Modifiers: abstract |
Clears all caches (does not dispose GPU resources). |
Full Usage:
this.Create
Parameters:
string
factory : unit -> 'T
Returns: 'T
Modifiers: abstract Type parameters: 'T |
Creates and caches a custom asset using the provided factory.
|
Full Usage:
this.Dispose
Modifiers: abstract |
Disposes all cached assets and clears caches. |
Full Usage:
this.Get
Parameters:
string
Returns: 'T voption
Modifiers: abstract Type parameters: 'T |
Gets a previously created custom asset by key.
|
Full Usage:
this.GetOrCreate
Parameters:
string
factory : unit -> 'T
Returns: 'T
Modifiers: abstract Type parameters: 'T |
Gets a cached asset or creates it if not present. This is the preferred method for custom assets - idempotent, ensures assets are created only once.
|
|
|
|
|
|
Mibo.Raylib