Class GameMap
- java.lang.Object
-
- bytemusketeers.heslingtonhustle.scene.GameMap
-
-
Field Summary
Fields Modifier and Type Field Description private int
height
The height of theGameMap
, in in-game metresprivate com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer
renderer
The LibGDX rendering object responsible for the rendering of theTiledMap
private static int
TILE_AXIS_LENGTH
The fixed width and height of all tiles, in pixelsprivate com.badlogic.gdx.maps.tiled.TiledMap
tiledMap
TheTiledMap
representing the loaded tilemap TMX fileprivate int
width
The 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.Vector2
bound(com.badlogic.gdx.math.Vector2 candidate, float horizontalGutter, float verticalGutter)
Bounds the given candidate vector along the determinedtiledMap
boundariesvoid
dispose()
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 theTiledMap
of the currentGameMap
void
render(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
Renders the entireGameMap
(package private) float
scale(float value)
Scales the given value, specified in pixels, to in-game metres(package private) void
updateView(com.badlogic.gdx.graphics.OrthographicCamera gameCam)
Instructs theOrthogonalTiledMapRenderer
to update its viewing position with respect to theOrthographicCamera
game 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
TheTiledMap
representing 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 newGameMap
with 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 InvalidAreaException
Retrieve the "borders" layer objects from theTiledMap
of the currentGameMap
- Returns:
- The
RectangleMapObject
objects 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 determinedtiledMap
boundaries- 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 theOrthogonalTiledMapRenderer
to update its viewing position with respect to theOrthographicCamera
game camera- Parameters:
gameCam
- TheOrthographicCamera
game camera against which theArea
viewport should be aligned
-
dispose
public void dispose()
Releases all resources used by theGameMap
- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
-