Interface MediaLoader
- All Known Implementing Classes:
GDXMediaLoader
,HeadlessMediaLoader
,JFXMediaLoader
,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 Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the specified resource file is available.Provides access to aGeometryBuilder
instance that can be used to create simple 3D geometry in a programmatic way.loadApplicationData
(String appName) Loads the application data for the application with the specified name.default SpriteAtlas
loadAtlas
(FilePointer file) Loads a sprite atlas based on the libGDX.atlas
file format.loadAudio
(FilePointer file) Loads an audio clip from a file.default FontFace
loadDefaultFont
(ColorRGB color) Loads the default font, the open source font Open Sans.loadFont
(FilePointer file, String family, FontStyle style) Loads a TrueType or FreeType font and converts it to a format that can be used by the renderer.loadImage
(FilePointer file) Loads an image from a file.loadModel
(FilePointer file) Loads a polygon model from the specified file.default Properties
loadProperties
(FilePointer file) Convenience method that loads and then parses the contents of a.properties
file.loadText
(FilePointer file) Loads a text-based resource file using UTF-8 encoding.loadTextLines
(FilePointer file) Loads a text-based resource file using UTF-8 encoding, and returns it as a list of lines.default nl.colorize.util.TranslationBundle
Convenience method that loads and then parses the contents of a.properties
file and returns aTranslationBundle
.void
saveApplicationData
(String appName, Properties data) Saves the application data for the application with the specified name.
-
Method Details
-
loadImage
Loads an image from a file. Images in JPEG and PNG format are supported by all renderers.- Throws:
MediaException
- if the format is not supported by the renderer.
-
loadAtlas
Loads a sprite atlas based on the libGDX.atlas
file format. This will parse the.atlas
file, and will then load all images used within the sprite atlas.- Throws:
MediaException
- if one of the images used in the sprite atlas uses a format that is not supported by the renderer,
-
loadAudio
Loads an audio clip from a file. MP3 files are supported by all renderers.- Throws:
MediaException
- if the format is not supported by the renderer.
-
loadFont
Loads a TrueType or FreeType font and converts it to a format that can be used by the renderer. The loaded font will be attached to the font family name specified in the font style.- Throws:
MediaException
- if the format is not supported by the renderer.
-
loadDefaultFont
Loads the default font, the open source font Open Sans. This is included in MultimediaLib and therefore guaranteed to be always available. -
loadModel
Loads a polygon model from the specified file. Only the GLTF format is guaranteed to be supported, other file formats are only supported by specific renderers.- Throws:
MediaException
- if the format is not supported by the renderer.UnsupportedGraphicsModeException
- if the renderer does not support 3D graphics.
-
getGeometryBuilder
GeometryBuilder getGeometryBuilder()Provides access to aGeometryBuilder
instance that can be used to create simple 3D geometry in a programmatic way.- Throws:
UnsupportedGraphicsModeException
- if the renderer does not support 3D graphics.
-
loadText
Loads a text-based resource file using UTF-8 encoding.- Throws:
MediaException
- if the file does not exist.
-
loadTextLines
Loads a text-based resource file using UTF-8 encoding, and returns it as a list of lines.- Throws:
MediaException
- if the file does not exist.
-
loadProperties
Convenience method that loads and then parses the contents of a.properties
file. By default, reading the file contents is delegated toloadText(FilePointer)
. -
loadTranslationBundle
Convenience method that loads and then parses the contents of a.properties
file and returns aTranslationBundle
. By default, reading the file contents is delegated toloadText(FilePointer)
. -
containsResourceFile
Returns whether the specified resource file is available. -
loadApplicationData
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 emptyProperties
when no application data exists. -
saveApplicationData
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.
-