Interface MediaLoader
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 TypeMethodDescriptionbooleancontainsResourceFile(nl.colorize.util.ResourceFile file) Returns whether the specified resource file is available.nl.colorize.util.SubscribableCollection<LoadStatus> Returns a buffer containing the load status of all media files that have been loaded by thisMediaLoader.loadApplicationData(String appName) Loads the application data for the application with the specified name.default SpriteAtlasloadAtlas(nl.colorize.util.ResourceFile file) Loads a sprite atlas based on the libGDX.atlasfile format.loadAudio(nl.colorize.util.ResourceFile file) Loads an audio clip from a file.default FontFaceloadDefaultFont(int size, ColorRGB color) Loads the default font, the open source font Open Sans.Loads a TrueType or FreeType font so the renderer can use that font for text rendering.loadImage(nl.colorize.util.ResourceFile file) Loads an image from a file.loadModel(nl.colorize.util.ResourceFile file) Loads a polygon model from the specified file.default PropertiesloadProperties(nl.colorize.util.ResourceFile file) Convenience method that loads and then parses the contents of a.propertiesfile.loadText(nl.colorize.util.ResourceFile file) Loads a text-based resource file using UTF-8 encoding.loadTextLines(nl.colorize.util.ResourceFile file) Loads a text-based resource file using UTF-8 encoding, and returns it as a list of lines.default nl.colorize.util.TranslationBundleloadTranslationBundle(nl.colorize.util.ResourceFile file) Convenience method that loads and then parses the contents of a.propertiesfile and returns aTranslationBundle.voidsaveApplicationData(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.atlasfile format. This will parse the.atlasfile, 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 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.- 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 OBJ and GLTF format are guaranteed to be supported, though certain renderers may support additional file formats.- Throws:
MediaException- if the format is not supported by this renderer.UnsupportedOperationException- if this 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.propertiesfile. By default, reading the file contents is delegated toloadText(ResourceFile). -
loadTranslationBundle
default nl.colorize.util.TranslationBundle loadTranslationBundle(nl.colorize.util.ResourceFile file) Convenience method that loads and then parses the contents of a.propertiesfile and returns aTranslationBundle. By default, reading the file contents is delegated toloadText(ResourceFile). -
containsResourceFile
boolean containsResourceFile(nl.colorize.util.ResourceFile file) 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 emptyPropertieswhen 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. -
getLoadStatus
nl.colorize.util.SubscribableCollection<LoadStatus> getLoadStatus()Returns a buffer containing the load status of all media files that have been loaded by thisMediaLoader.
-