-
Notifications
You must be signed in to change notification settings - Fork 6
The ImageLoader
In this wiki page, you will be shown how to use the ImageLoader
.
The ImageLoader
is located at de.edgelord.saltyengine.utils.ImageLoader
.
With it, you can load images and use them globally. The images are saved in a String
to SaltyImage
HashMap
.
All features of this class are static
, so you won't ever need to instantiate it.
You can load an image using ImageLoader#loadNewImage(String name, String relativePath, ImageFactory imgFactory)
or
ImageLoader#loadImage(String name, String relativePath)
to use SaltySystem#defaultImageFactory
as the source for the image.
Both methods will store a new SaltyImage
with the given name into the map. The image is loaded from the factory at the given
relative path.
You can get a SaltyImage
that is already loaded using ImageLoader#getImage(String name)
.
If you cannot be sure if the image was already loaded before, use ImageLoader#getOrLoadImage(String name, String relativePath[, ImageFactory imgFactory])
.
- You can also check if an image with a specific name was already loaded using
ImageLoader#imageAlreadyLoaded(String name)
or check if a certainSaltyImage
was already loaded usingImageLoader#imageAlreadyLoaded(SaltyImage image)
. - You can remove a loaded image using
ImageLoader#removeImage(String name)
- and remove all loaded images using
ImageLoader#removeAll()