Interface MediaLoader

  • All Known Implementing Classes:
    GDXMediaLoader, StandardMediaLoader, TeaMediaLoader

    public interface MediaLoader
    Loads media files such as images or audio in a format that can later be used by the renderer. Using this interface to load resource files is guaranteed to work on all platforms that are supported by MultimediaLib. Using other ways of loading files, such as directly from the file system or from the classpath, may not be supported on some platforms.
    • Method Detail

      • loadImage

        Image loadImage​(FilePointer file)
        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.
        Throws:
        MediaException - if the image format is not supported by the renderer or by the platform, or if the file does not exist.
      • loadAudio

        Audio loadAudio​(FilePointer file)
        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.
        Throws:
        MediaException - if the audio format is not supported by the renderer or by the platform, or if the file does not exist.
      • loadFont

        TTFont loadFont​(java.lang.String fontFamily,
                        FilePointer file)
        Loads a TrueType font from a .ttf file.
        Parameters:
        fontFamily - The logical name of the font family that is being loaded.
        Throws:
        MediaException - if the file does not exist, or if the font cannot be loaded on the current platform.
      • loadDefaultFont

        default TTFont loadDefaultFont()
        Loads the default font, the open source font Open Sans. This is included in MultimediaLib and therefore guaranteed to be always available.
      • loadText

        java.lang.String loadText​(FilePointer file)
        Loads a text-based resource file using UTF-8 encoding. T
        Throws:
        MediaException - if the file does not exist.
      • containsResourceFile

        boolean containsResourceFile​(FilePointer file)