Class GDXMediaLoader

  • All Implemented Interfaces:
    com.badlogic.gdx.utils.Disposable, MediaLoader

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

    libGDX requires an explicit dispose step to close all loaded media files and release the associated resources. This can be done globally for all media files by calling dispose().

    • Constructor Detail

      • GDXMediaLoader

        public GDXMediaLoader()
    • Method Detail

      • loadImage

        public Image loadImage​(FilePointer file)
        Description copied from interface: MediaLoader
        Loads an image from a file. JPEG and PNG images are guaranteed to be supported, though other image formats may also be supported depending on the platform.
        Specified by:
        loadImage in interface MediaLoader
      • loadAudio

        public Audio loadAudio​(FilePointer file)
        Description copied from interface: MediaLoader
        Loads an audio clip from a file. OGG and MP3 files are guaranteed to be supported, though other audio formats may be also be supported depending on the platform.
        Specified by:
        loadAudio in interface MediaLoader
      • getColorTexture

        public com.badlogic.gdx.graphics.Texture getColorTexture​(ColorRGB color)
      • loadFont

        public TTFont loadFont​(FilePointer file,
                               java.lang.String family,
                               int size,
                               ColorRGB color,
                               boolean bold)
        Description copied from interface: MediaLoader
        Loads a TrueType font from a .ttf file and converts it to a format that can be used by the renderer.
        Specified by:
        loadFont in interface MediaLoader
      • getBitmapFont

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

        public java.lang.String loadText​(FilePointer file)
        Description copied from interface: MediaLoader
        Loads a text-based resource file using UTF-8 encoding.
        Specified by:
        loadText in interface MediaLoader
      • loadMesh

        public PolygonMesh loadMesh​(FilePointer file)
        Description copied from interface: MediaLoader
        Loads a polygon mesh from the specified file. Only the FBX file format is supported by all renderer implementations.
        Specified by:
        loadMesh in interface MediaLoader
      • registerMesh

        protected PolygonMesh registerMesh​(java.lang.String name,
                                           com.badlogic.gdx.graphics.g3d.Model modelData)
      • getModelData

        protected com.badlogic.gdx.graphics.g3d.Model getModelData​(PolygonMesh mesh)
      • toColor

        public com.badlogic.gdx.graphics.Color toColor​(ColorRGB color)
      • dispose

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