Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: FXGLAssetLoaderService

[33:7] extends: AssetLoaderService

Wraps FXGL's FXGLAssetLoaderService (com.almasb.fxgl.app.services.FXGLAssetLoaderService), the concrete in-engine implementation of AssetLoaderService used by every running FXGL game. Each load method has a documented assets-folder convention: loadImage - /assets/textures/ loadTexture - /assets/textures/ loadSound - /assets/sounds/ loadMusic - /assets/music/ loadText - /assets/text/ loadCSS - /assets/ui/css/ loadFont - /assets/ui/fonts/ loadUI - /assets/ui/ loadModel3D - /assets/models/ loadVideo - /assets/videos/ loadResourceBundle / loadPropertyMap - /assets/properties/ loadDialogueGraph - /assets/dialogues/ Reached at runtime via fxgl.getAssetLoader; obtain a wrapper via adopt.

Methods

  • FXGLAssetLoaderService ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing FXGLAssetLoaderService AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a FXGLAssetLoaderService.
    • @r A new wrapper.
  • loadTexture (string Name)

    Loads an image from /assets/textures/ and wraps it in a Texture.

    • @p Name is the image file name.
    • @r A Texture wrapper.
  • loadTextureSized (string Name, double Width, double Height)

    Loads an image from /assets/textures/ at the requested size and wraps it in a Texture.

    • @p Name is the image file name.
    • @p Width is the desired width in pixels.
    • @p Height is the desired height in pixels.
    • @r A Texture wrapper.
  • loadTextureFromUrl (string UrlString)

    Loads a Texture from a URL string.

    • @p UrlString is the source URL.
    • @r A Texture wrapper.
  • loadImage (string Name)

    Loads an Image from /assets/textures/.

    • @p Name is the image file name.
    • @r An AussomJavaObject around a javafx.scene.image.Image.
  • loadImageFromUrl (string UrlString)

    Loads an Image from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a javafx.scene.image.Image.
  • loadSound (string Name)

    Loads a Sound from /assets/sounds/. Sound files are AudioClip-backed and best for short effects.

    • @p Name is the sound file name (e.g. "explosion.wav").
    • @r An AussomJavaObject around a Sound.
  • loadSoundFromUrl (string UrlString)

    Loads a Sound from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a Sound.
  • loadMusic (string Name)

    Loads a Music track from /assets/music/. Music files are MediaPlayer-backed and best for long background tracks.

    • @p Name is the music file name (e.g. "bgm.mp3").
    • @r An AussomJavaObject around a Music.
  • loadMusicFromUrl (string UrlString)

    Loads a Music track from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a Music.
  • loadResourceBundle (string Name)

    Loads a resource bundle from /assets/properties/. For better mobile support use loadPropertyMap instead.

    • @p Name is the resource bundle file name.
    • @r An AussomJavaObject around a ResourceBundle.
  • loadResourceBundleFromUrl (string UrlString)

    Loads a resource bundle from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a ResourceBundle.
  • loadDialogueGraph (string Name)

    Loads a DialogueGraph from /assets/dialogues/.

    • @p Name is the dialogue file name (e.g. "npc_intro.json").
    • @r An AussomJavaObject around a DialogueGraph.
  • loadDialogueGraphFromUrl (string UrlString)

    Loads a DialogueGraph from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a DialogueGraph.
  • loadCutscene (string Name)

    Loads a Cutscene from /assets/text/.

    • @p Name is the cutscene script file name.
    • @r An AussomJavaObject around a Cutscene.
  • loadCutsceneFromUrl (string UrlString)

    Loads a Cutscene from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a Cutscene.
  • loadText (string Name)

    Loads a text file from /assets/text/, returning each line as a separate list entry.

    • @p Name is the text file name (e.g. "level_0.txt").
    • @r An AussomJavaObject around a List.
  • loadTextFromUrl (string UrlString)

    Loads a text file from a URL string as a list of lines.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a List.
  • loadJSON (string Name, string ClassName)

    Loads and parses a JSON file from /assets/. Pass the Java class name for the target Jackson-deserialized type.

    • @p Name is the JSON file name relative to /assets/.
    • @p ClassName is the fully qualified Java class name of the deserialization target.
    • @r An AussomJavaObject around an Optional.
  • loadJSONFromUrl (string UrlString, string ClassName)

    Loads and parses a JSON file from a URL string.

    • @p UrlString is the source URL.
    • @p ClassName is the fully qualified Java class name of the deserialization target.
    • @r An AussomJavaObject around an Optional.
  • loadPropertyMap (string Name)

    Loads a property map from /assets/.

    • @p Name is the property map file name (e.g. "languages/english.pmap").
    • @r An AussomJavaObject around a PropertyMap.
  • loadPropertyMapFromUrl (string UrlString)

    Loads a property map from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a PropertyMap.
  • loadFont (string Name)

    Loads a font from /assets/ui/fonts/ and wraps it in a FontFactory.

    • @p Name is the font file name (e.g. "quest.ttf").
    • @r An AussomJavaObject around a FontFactory.
  • loadFontFromUrl (string UrlString)

    Loads a font from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a FontFactory.
  • loadCSS (string Name)

    Loads a CSS file from /assets/ui/css/.

    • @p Name is the CSS file name.
    • @r An AussomJavaObject around an FXGL CSS object.
  • loadCSSFromUrl (string UrlString)

    Loads a CSS file from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around an FXGL CSS object.
  • loadLevel (string Name, object LoaderObj)

    Loads a level file from /assets/levels/ using the supplied LevelLoader instance.

    • @p Name is the level file name.
    • @p LoaderObj is an AussomJavaObject around a LevelLoader.
    • @r An AussomJavaObject around a Level.
  • loadUI (string Name, object ControllerObj)

    Loads an FXML UI file from /assets/ui/ with the given UIController.

    • @p Name is the FXML file name.
    • @p ControllerObj is an AussomJavaObject around a UIController.
    • @r An AussomJavaObject around a UI object.
  • loadUIFromUrl (string UrlString, object ControllerObj)

    Loads an FXML UI file from a URL string with the given UIController.

    • @p UrlString is the source URL.
    • @p ControllerObj is an AussomJavaObject around a UIController.
    • @r An AussomJavaObject around a UI object.
  • loadModel3D (string Name)

    Loads a 3D model from /assets/models/.

    • @p Name is the model file name (e.g. "ship.obj").
    • @r An AussomJavaObject around a Model3D.
  • loadModel3DFromUrl (string UrlString)

    Loads a 3D model from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a Model3D.
  • loadVideo (string Name)

    Loads a video from /assets/videos/.

    • @p Name is the video file name.
    • @r An AussomJavaObject around a MediaView.
  • loadVideoFromUrl (string UrlString)

    Loads a video from a URL string.

    • @p UrlString is the source URL.
    • @r An AussomJavaObject around a MediaView.
  • getStream (string Name)

    Opens an InputStream to a named resource. The caller is responsible for closing the stream. Useful for assets not covered by the typed load methods.

    • @p Name is the resource path starting with "/".
    • @r An AussomJavaObject around a java.io.InputStream.
  • clearCache ()

    Clears every cached asset, freeing memory.

    • @r this object