Class TeaMediaLoader
java.lang.Object
nl.colorize.multimedialib.renderer.teavm.TeaMediaLoader
- All Implemented Interfaces:
MediaLoader
Delegates media loading to the browser. Images, audio, and fonts are loaded
using the conventional browser APIs. Text files are embedded into the HTML
during the build, and can therefore be loaded immediately.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.teavm.jso.dom.html.HTMLCanvasElement
Creates an alternative version of the image with the specified mask color applied to every non-transparent pixel.boolean
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.nl.colorize.util.MessageQueue
<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.loadAudio
(FilePointer file) Loads an audio clip from a file.loadFont
(FilePointer file, String family, int size, ColorRGB color) Loads a TrueType or FreeType font so the renderer can use that font for text rendering.loadImage
(FilePointer file) Loads an image from a file.loadModel
(FilePointer file) Loads a polygon model from the specified file.loadText
(FilePointer file) Loads a text-based resource file using UTF-8 encoding.protected String
normalizeFilePath
(FilePointer file, boolean replaceDot) void
saveApplicationData
(String appName, Properties data) Saves the application data for the application with the specified name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nl.colorize.multimedialib.renderer.MediaLoader
loadAtlas, loadDefaultFont, loadProperties, loadTextLines, loadTranslationBundle
-
Constructor Details
-
TeaMediaLoader
protected TeaMediaLoader()
-
-
Method Details
-
loadImage
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 interfaceMediaLoader
-
loadAudio
Description copied from interface:MediaLoader
Loads an audio clip from a file. MP3 files are supported by all renderers.- Specified by:
loadAudio
in interfaceMediaLoader
-
loadFont
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 interfaceMediaLoader
-
loadModel
Description copied from interface:MediaLoader
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.- Specified by:
loadModel
in interfaceMediaLoader
-
getGeometryBuilder
Description copied from interface:MediaLoader
Provides access to aGeometryBuilder
instance that can be used to create simple 3D geometry in a programmatic way.- Specified by:
getGeometryBuilder
in interfaceMediaLoader
-
loadText
Description copied from interface:MediaLoader
Loads a text-based resource file using UTF-8 encoding.- Specified by:
loadText
in interfaceMediaLoader
-
containsResourceFile
Description copied from interface:MediaLoader
Returns whether the specified resource file is available.- Specified by:
containsResourceFile
in interfaceMediaLoader
-
normalizeFilePath
-
loadApplicationData
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 emptyProperties
when no application data exists.- Specified by:
loadApplicationData
in interfaceMediaLoader
-
saveApplicationData
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 interfaceMediaLoader
-
getLoadStatus
Description copied from interface:MediaLoader
Returns a buffer containing the load status of all media files that have been loaded by thisMediaLoader
.- Specified by:
getLoadStatus
in interfaceMediaLoader
-
applyMask
Creates an alternative version of the image with the specified mask color applied to every non-transparent pixel. This is a relatively heavy operation, so masked images are cached to avoid having to create them every single frame.
-