Class GameMap
- java.lang.Object
-
- bytemusketeers.heslingtonhustle.scene.GameMap
-
-
Field Summary
Fields Modifier and Type Field Description private intheightThe height of theGameMap, in in-game metresprivate com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRendererrendererThe LibGDX rendering object responsible for the rendering of theTiledMapprivate static intTILE_AXIS_LENGTHThe fixed width and height of all tiles, in pixelsprivate com.badlogic.gdx.maps.tiled.TiledMaptiledMapTheTiledMaprepresenting the loaded tilemap TMX fileprivate intwidthThe width of theGameMap, in in-game metres
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) com.badlogic.gdx.math.Vector2bound(com.badlogic.gdx.math.Vector2 candidate, float horizontalGutter, float verticalGutter)Bounds the given candidate vector along the determinedtiledMapboundariesvoiddispose()Releases all resources used by theGameMap(package private) com.badlogic.gdx.utils.Array<com.badlogic.gdx.maps.objects.RectangleMapObject>getBorderObjects()Retrieve the "borders" layer objects from theTiledMapof the currentGameMapvoidrender(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)Renders the entireGameMap(package private) floatscale(float value)Scales the given value, specified in pixels, to in-game metres(package private) voidupdateView(com.badlogic.gdx.graphics.OrthographicCamera gameCam)Instructs theOrthogonalTiledMapRendererto update its viewing position with respect to theOrthographicCameragame camera
-
-
-
Field Detail
-
TILE_AXIS_LENGTH
private static final int TILE_AXIS_LENGTH
The fixed width and height of all tiles, in pixels- See Also:
- Constant Field Values
-
tiledMap
private final com.badlogic.gdx.maps.tiled.TiledMap tiledMap
TheTiledMaprepresenting the loaded tilemap TMX file- See Also:
TmxMapLoader.load(String)
-
renderer
private final com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer renderer
The LibGDX rendering object responsible for the rendering of theTiledMap- See Also:
TiledMap
-
width
private final int width
The width of theGameMap, in in-game metres
-
height
private final int height
The height of theGameMap, in in-game metres
-
-
Constructor Detail
-
GameMap
GameMap(java.lang.String mapPath) throws InvalidAreaException
Creates a newGameMapwith the given map path- Parameters:
mapPath- The path of the map- Throws:
InvalidAreaException- The map was invalid could not be loaded into the area
-
-
Method Detail
-
getBorderObjects
com.badlogic.gdx.utils.Array<com.badlogic.gdx.maps.objects.RectangleMapObject> getBorderObjects() throws InvalidAreaExceptionRetrieve the "borders" layer objects from theTiledMapof the currentGameMap- Returns:
- The
RectangleMapObjectobjects embedded in the requested layer - Throws:
InvalidAreaException
-
scale
float scale(float value)
Scales the given value, specified in pixels, to in-game metres- Parameters:
value- The quantity to scale, in pixels- Returns:
- The scaled quantity, in in-game metres
-
bound
com.badlogic.gdx.math.Vector2 bound(com.badlogic.gdx.math.Vector2 candidate, float horizontalGutter, float verticalGutter)Bounds the given candidate vector along the determinedtiledMapboundaries- Parameters:
candidate- The vector to be boundedhorizontalGutter- The gutter, specified as in-game metres, on the horizontal axisverticalGutter- The gutter, specified as in-game metres, on the vertical axis- Returns:
- The bounded vector
- See Also:
Area.bound(Vector2, float, float)
-
updateView
void updateView(com.badlogic.gdx.graphics.OrthographicCamera gameCam)
Instructs theOrthogonalTiledMapRendererto update its viewing position with respect to theOrthographicCameragame camera- Parameters:
gameCam- TheOrthographicCameragame camera against which theAreaviewport should be aligned
-
dispose
public void dispose()
Releases all resources used by theGameMap- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
-