Class GDXMediaLoader

java.lang.Object
nl.colorize.multimedialib.renderer.libgdx.GDXMediaLoader
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, MediaLoader

public class GDXMediaLoader extends Object implements MediaLoader, com.badlogic.gdx.utils.Disposable
Loads media assets using the libGDX framework.

and release the associated resources. This can be done globally for all media files by calling dispose().

  • Constructor Details

    • GDXMediaLoader

      public GDXMediaLoader()
  • Method Details

    • loadImage

      public Image loadImage(nl.colorize.util.ResourceFile file)
      Description copied from interface: MediaLoader
      Loads an image from a file. Images in JPEG and PNG format are supported by all renderers.
      Specified by:
      loadImage in interface MediaLoader
    • loadAudio

      public Audio loadAudio(nl.colorize.util.ResourceFile file)
      Description copied from interface: MediaLoader
      Loads an audio clip from a file. MP3 files are supported by all renderers.
      Specified by:
      loadAudio in interface MediaLoader
    • loadFont

      public FontFace loadFont(nl.colorize.util.ResourceFile file, String family, int size, ColorRGB color)
      Description copied from interface: MediaLoader
      Loads a TrueType or FreeType font so the renderer can use that font for text rendering. This will return a font for the specified style, alternative styles can be derived from the returned font.
      Specified by:
      loadFont in interface MediaLoader
    • getBitmapFont

      protected com.badlogic.gdx.graphics.g2d.BitmapFont getBitmapFont(FontFace font)
    • loadText

      public String loadText(nl.colorize.util.ResourceFile file)
      Description copied from interface: MediaLoader
      Loads a text-based resource file using UTF-8 encoding.
      Specified by:
      loadText in interface MediaLoader
    • loadModel

      public Mesh loadModel(nl.colorize.util.ResourceFile file)
      Description copied from interface: MediaLoader
      Loads a polygon model from the specified file. Only the OBJ and GLTF format are guaranteed to be supported, though certain renderers may support additional file formats.
      Specified by:
      loadModel in interface MediaLoader
    • containsResourceFile

      public boolean containsResourceFile(nl.colorize.util.ResourceFile file)
      Description copied from interface: MediaLoader
      Returns whether the specified resource file is available.
      Specified by:
      containsResourceFile in interface MediaLoader
    • loadApplicationData

      public Properties loadApplicationData(String appName)
      Description copied from interface: MediaLoader
      Loads the application data for the application with the specified name. Application data is limited to key/value properties, as this type of data is supported by all platforms. Returns an empty Properties when no application data exists.
      Specified by:
      loadApplicationData in interface MediaLoader
    • saveApplicationData

      public void saveApplicationData(String appName, Properties data)
      Description copied from interface: MediaLoader
      Saves the application data for the application with the specified name. Application data is limited to key/value properties, as this type of data is supported by all platforms.
      Specified by:
      saveApplicationData in interface MediaLoader
    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
    • toColor

      protected static com.badlogic.gdx.graphics.Color toColor(ColorRGB color)
    • toColor

      protected static ColorRGB toColor(com.badlogic.gdx.graphics.Color color)
    • getLoadStatus

      public nl.colorize.util.SubscribableCollection<LoadStatus> getLoadStatus()
      Description copied from interface: MediaLoader
      Returns a buffer containing the load status of all media files that have been loaded by this MediaLoader.
      Specified by:
      getLoadStatus in interface MediaLoader