Class Resources
java.lang.Object
de.gurkenlabs.litiengine.resources.Resources
This class is the engines entry point for accessing any kind of resources. A resource is any non-executable data that
is deployed with your game. The
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:
- images
- fonts
- maps
- (localizable) strings
- spritesheets
- sounds
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic BlueprintsGets the container that managesBlueprintresources.static voidclearAll()Clears the all resource containers by removing previously loaded resources.static Fontsfonts()Gets the container that managesFontresources.static InputStreamGets the specified file as InputStream from either a resource folder or the file system.static InputStreamGets the specified file as InputStream from either a resource folder or the file system.static URLgetLocation(String name) static Imagesimages()Gets the container that managesBufferedImageresources.static voidLoadSpritesheets,TilesetsandMapsfrom a game resource file created with the utiLITI editor.static voidLoadSpritesheets,TilesetsandMapsfrom a game resource file created with the utiLITI editor.static Mapsmaps()Gets the container that managesIMapresources.static StringReads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.static StringReads the specified file as String from either a resource folder or the file system.static StringReads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.static StringReads the specified file as String from either a resource folder or the file system.static Soundssounds()Gets the container that managesSoundresources.static SpritesheetsGets the container that managesSpritesheetresources.static Stringsstrings()Gets a container that managesStringresources.
This instance can be used to access localizable string from a ".properties" file.static Tilesetstilesets()Gets the container that managesTilesetresources.
This implementation uses rawTilesets, to avoid problems withTilesetmethods that aren't in theITilesetinterface.
-
Method Details
-
fonts
Gets the container that managesFontresources.- Returns:
- The Font resource container.
- See Also:
-
sounds
Gets the container that managesSoundresources.- Returns:
- The Sound resource container.
- See Also:
-
maps
Gets the container that managesIMapresources.- Returns:
- The IMap resource container.
- See Also:
-
tilesets
Gets the container that managesTilesetresources.
This implementation uses rawTilesets, to avoid problems withTilesetmethods that aren't in theITilesetinterface.- Returns:
- The Tileset resource container.
- See Also:
-
strings
Gets a container that managesStringresources.
This instance can be used to access localizable string from a ".properties" file.- Returns:
- The String resource container.
-
images
Gets the container that managesBufferedImageresources.- Returns:
- The BufferedImage resource container.
- See Also:
-
spritesheets
Gets the container that managesSpritesheetresources.- Returns:
- The Spritesheet resource container.
- See Also:
-
blueprints
Gets the container that managesBlueprintresources.- Returns:
- The Blueprint resource container.
- See Also:
-
load
LoadSpritesheets,TilesetsandMapsfrom 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").- Parameters:
gameResourceFile- The file name of the game resource file
-
load
LoadSpritesheets,TilesetsandMapsfrom 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").- Parameters:
gameResourceFile- The URL to the game resource file
-
get
Gets the specified file as InputStream from either a resource folder or the file system.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
InputStream. - See Also:
-
get
Gets the specified file as InputStream from either a resource folder or the file system.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
InputStream. - See Also:
-
read
Reads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
String
-
read
Reads the specified file as String from either a resource folder or the file system.- Parameters:
file- The path to the file.charset- The charset that is used to read the String from the file.- Returns:
- The contents of the specified file as
String
-
read
Reads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
String
-
read
Reads the specified file as String from either a resource folder or the file system.- Parameters:
file- The path to the file.charset- The charset that is used to read the String from the file.- Returns:
- The contents of the specified file as
String
-
clearAll
public static void clearAll()Clears the all resource containers by removing previously loaded resources. -
getLocation
-