public final class Resources
extends java.lang.Object
Resources class provides access to types of ResourcesContainers and is used by different (loading) mechanisms to make
resources available during runtime.
The LITIengine supports a variety of different resource types, including:
ResourcesContainer| Modifier and Type | Method and Description |
|---|---|
static Blueprints |
blueprints()
Gets the container that manages
Blueprint resources. |
static void |
clearAll()
Clears the all resource containers by removing previously loaded resources.
|
static Fonts |
fonts()
Gets the container that manages
Font resources. |
static java.io.InputStream |
get(java.lang.String file)
Gets the specified file as InputStream from either a resource folder or the file system.
|
static java.io.InputStream |
get(java.net.URL file)
Gets the specified file as InputStream from either a resource folder or the file system.
|
static java.net.URL |
getLocation(java.lang.String name) |
static Images |
images()
Gets the container that manages
BufferedImage resources. |
static void |
load(java.lang.String gameResourceFile)
Load
Spritesheets, Tilesets and Maps from a game resource file created with the utiLITI editor. |
static void |
load(java.net.URL gameResourceFile)
Load
Spritesheets, Tilesets and Maps from a game resource file created with the utiLITI editor. |
static Maps |
maps()
Gets the container that manages
IMap resources. |
static java.lang.String |
read(java.lang.String file)
Reads the specified file as String from either a resource folder or the file system.
Since no Charset is specified with this overload, the implementation uses UTF-8 by default. |
static java.lang.String |
read(java.lang.String file,
java.nio.charset.Charset charset)
Reads the specified file as String from either a resource folder or the file system.
|
static java.lang.String |
read(java.net.URL file)
Reads the specified file as String from either a resource folder or the file system.
Since no Charset is specified with this overload, the implementation uses UTF-8 by default. |
static java.lang.String |
read(java.net.URL file,
java.nio.charset.Charset charset)
Reads the specified file as String from either a resource folder or the file system.
|
static Sounds |
sounds()
Gets the container that manages
Sound resources. |
static Spritesheets |
spritesheets()
Gets the container that manages
Spritesheet resources. |
static Strings |
strings()
Gets a container that manages
String resources.This instance can be used to access localizable string from a ".properties" file. |
static Tilesets |
tilesets()
Gets the container that manages
Tileset resources.This implementation uses raw Tilesets, to avoid problems with
Tileset methods that aren't in the ITileset interface. |
public static Fonts fonts()
Font resources.Fontpublic static Sounds sounds()
Sound resources.Soundpublic static Maps maps()
IMap resources.IMappublic static Tilesets tilesets()
Tileset resources.Tilesets, to avoid problems with
Tileset methods that aren't in the ITileset interface.Tilesetpublic static Strings strings()
String resources.public static Images images()
BufferedImage resources.BufferedImagepublic static Spritesheets spritesheets()
Spritesheet resources.Spritesheetpublic static Blueprints blueprints()
Blueprint resources.Blueprintpublic static void load(java.lang.String gameResourceFile)
Spritesheets, Tilesets and Maps from a game resource file created with the utiLITI editor.
After loading, these resources can be accessed via this API (e.g. Resources.maps().get("mapname").gameResourceFile - The file name of the game resource filepublic static void load(java.net.URL gameResourceFile)
Spritesheets, Tilesets and Maps from a game resource file created with the utiLITI editor.
After loading, these resources can be accessed via this API (e.g. Resources.maps().get("mapname").gameResourceFile - The URL to the game resource filepublic static java.io.InputStream get(java.lang.String file)
file - The path to the file.InputStream.Resourcespublic static java.io.InputStream get(java.net.URL file)
file - The path to the file.InputStream.Resourcespublic static java.lang.String read(java.lang.String file)
Charset is specified with this overload, the implementation uses UTF-8 by default.file - The path to the file.Stringpublic static java.lang.String read(java.lang.String file,
java.nio.charset.Charset charset)
file - The path to the file.charset - The charset that is used to read the String from the file.Stringpublic static java.lang.String read(java.net.URL file)
Charset is specified with this overload, the implementation uses UTF-8 by default.file - The path to the file.Stringpublic static java.lang.String read(java.net.URL file,
java.nio.charset.Charset charset)
file - The path to the file.charset - The charset that is used to read the String from the file.Stringpublic static void clearAll()
public static java.net.URL getLocation(java.lang.String name)