Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

The ImageLoader

edgelord edited this page Mar 22, 2019 · 1 revision

The ImageLoader

In this wiki page, you will be shown how to use the ImageLoader.

General information

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.

Loading images

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.

Requesting images

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]).

Other features

  • You can also check if an image with a specific name was already loaded using ImageLoader#imageAlreadyLoaded(String name) or check if a certain SaltyImage was already loaded using ImageLoader#imageAlreadyLoaded(SaltyImage image).
  • You can remove a loaded image using ImageLoader#removeImage(String name)
  • and remove all loaded images using ImageLoader#removeAll()