Package com.mygdx.game.Managers
Class ResourceManager
- java.lang.Object
 - 
- com.mygdx.game.Managers.ResourceManager
 
 
- 
public final class ResourceManager extends java.lang.ObjectManages all assets and disposes of them when appropriate 
- 
- 
Constructor Summary
Constructors Constructor Description ResourceManager() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddTexture(java.lang.String fPath)Schedules an asset for loading Amended for assessment 2: Made the method return voidstatic voidaddTextureAtlas(java.lang.String fPath)Schedules an asset for loading Amended for assessment 2: Made the method return voidstatic intaddTileMap(java.lang.String fPath)Prefaces name with |TM| followed by the internal index of the tilemap however this isn't required to access this assetstatic voidcleanUp()It is imperative that this is called unless you want memory leeksstatic voiddispose()Added for Assessment 2 Calls cleanup function and disposes of remaining assetsstatic intgetId(java.lang.String name)only looks for simple assets not specialty ones so largely only texturesstatic com.badlogic.gdx.graphics.g2d.SpritegetSprite(int atlas_id, java.lang.String name)static com.badlogic.gdx.graphics.TexturegetTexture(int id)static com.badlogic.gdx.graphics.TexturegetTexture(java.lang.String fPath)static com.badlogic.gdx.graphics.g2d.TextureAtlasgetTextureAtlas(int id)static com.badlogic.gdx.graphics.g2d.TextureAtlasgetTextureAtlas(java.lang.String fPath)static com.badlogic.gdx.maps.tiled.TiledMapgetTileMap(int id)Gets the tile map returns null if not a tile mapstatic voidInitialize()The equivalent to a constructorstatic voidloadAssets()Actually loads the assets 
 - 
 
- 
- 
Method Detail
- 
Initialize
public static void Initialize()
The equivalent to a constructor 
- 
addTexture
public static void addTexture(java.lang.String fPath)
Schedules an asset for loading Amended for assessment 2: Made the method return void- Parameters:
 fPath- the file path of the asset
 
- 
addTextureAtlas
public static void addTextureAtlas(java.lang.String fPath)
Schedules an asset for loading Amended for assessment 2: Made the method return void- Parameters:
 fPath- the file path of the asset
 
- 
addTileMap
public static int addTileMap(java.lang.String fPath)
Prefaces name with |TM| followed by the internal index of the tilemap however this isn't required to access this asset- Parameters:
 fPath- the file location of the asset- Returns:
 - id of the asset
 
 
- 
loadAssets
public static void loadAssets()
Actually loads the assets 
- 
getTexture
public static com.badlogic.gdx.graphics.Texture getTexture(java.lang.String fPath)
 
- 
getTextureAtlas
public static com.badlogic.gdx.graphics.g2d.TextureAtlas getTextureAtlas(java.lang.String fPath)
 
- 
getTexture
public static com.badlogic.gdx.graphics.Texture getTexture(int id)
 
- 
getTextureAtlas
public static com.badlogic.gdx.graphics.g2d.TextureAtlas getTextureAtlas(int id)
 
- 
getSprite
public static com.badlogic.gdx.graphics.g2d.Sprite getSprite(int atlas_id, java.lang.String name)- Parameters:
 atlas_id- the id of the source texture atlasname- the name of the texture- Returns:
 - the found Sprite in the given atlas
 
 
- 
getTileMap
public static com.badlogic.gdx.maps.tiled.TiledMap getTileMap(int id)
Gets the tile map returns null if not a tile map- Parameters:
 id- the id of the tile map- Returns:
 - the tile map
 
 
- 
getId
public static int getId(java.lang.String name)
only looks for simple assets not specialty ones so largely only textures- Parameters:
 name- the desired asset name- Returns:
 - the id of the asset found if found
 
 
- 
cleanUp
public static void cleanUp()
It is imperative that this is called unless you want memory leeks 
- 
dispose
public static void dispose()
Added for Assessment 2 Calls cleanup function and disposes of remaining assets 
 - 
 
 -