Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: AssetLoaderService

[21:7] extends: EngineService

Wraps FXGL's abstract AssetLoaderService base (com.almasb.fxgl.core.asset.AssetLoaderService), the EngineService contract every asset-loader implementation extends. Exposes the generic load methods plus the URL resolver. The concrete in-engine implementation is FXGLAssetLoaderService -- prefer that wrapper for asset loading. Aussom users hold an AssetLoaderService wrapper via adopt after obtaining the running implementation; direct construction is not supported because the class is abstract.

Methods

  • AssetLoaderService ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing AssetLoaderService AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an AssetLoaderService.
    • @r A new wrapper.
  • load (string AssetTypeName, string FileName)

    Loads an asset of the named AssetType from the given file name (relative to the asset type's directory). Returns the loaded object as an AussomJavaObject; cast on the caller side based on the AssetType.

    • @p AssetTypeName is the AssetType enum name (e.g. "IMAGE", "SOUND", "MUSIC", "TEXT", "MODEL3D").
    • @p FileName is the file name relative to the type's dir.
    • @r An AussomJavaObject around the loaded asset.
  • loadFromUrl (string AssetTypeName, string UrlString)

    Loads an asset of the named AssetType from the given URL string.

    • @p AssetTypeName is the AssetType enum name.
    • @p UrlString is the URL string.
    • @r An AussomJavaObject around the loaded asset.
  • getURL (string Name)

    Returns a URL to a named asset. Name must be relative to the resource root and start with "/" (e.g. "/assets/textures/player.png"). Returns the engine's NULL_URL sentinel if the asset is not found.

    • @p Name is the resource path starting with "/".
    • @r An AussomJavaObject around a java.net.URL.