|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.haphazard.gui.engine.Map
Handles a map of the world
Field Summary | |
Point3D |
camera
|
java.lang.String |
mLink
|
Point3D |
screenStart
if you ever want to start drawing from another pixel-location than 0,0,0 |
java.awt.Dimension |
screenTileDimension
how many tiles to draw on the screen do NOT set this to more than necessary |
static int[][][] |
viewArea
|
Constructor Summary | |
Map(int width,
int height)
Creates a new instance of Map |
|
Map(int width,
int height,
java.lang.String name)
Creates a new instance of Map |
Method Summary | |
boolean |
canWalkOnTile(Point3D tileCoordinate)
Checks if a character can walk on a tile |
void |
centerCameraOn(Point3D location)
Centers the camera on the specified location |
int |
coordinateCheck(Point3D pos)
Checks if it's OK to move to the position |
java.awt.Dimension |
getDimension()
Gets the dimension of this map |
java.lang.String |
getName()
returns the name of this map |
Tile |
getTile(Point3D location)
Gets the tile for a certain location |
java.awt.Dimension |
getTileDimension()
Returns the dimension of the tiles in this Map. |
boolean |
isOnMap(int x,
int y)
Checks if a point is within the map |
boolean |
isOnMap(Point3D coordinate)
Checks if a point is within the map |
void |
optimize()
optimize this ground by drawing all non-animated tiles to a BufferedImage |
void |
paintBackground(java.awt.Graphics2D g,
int windowWidth,
int windowHeight)
This draws the ground to a Graphics2d |
void |
paintComponent(java.awt.Graphics2D g,
int windowWidth,
int windowHeight)
Paints the map |
java.awt.Point |
project(Point3D coordinate)
project the tile x and y coordinate to screen coordinate FIXME: add functionality to take care of elevated tiles |
void |
setFogOfWar(Point3D middleLocation,
boolean value)
Sets the fog of war on a specified coordinate |
void |
setSubWorld(java.lang.String subWorld,
Point3D location,
Point3D enterLocation)
Sets a subWorld on a specific tile |
void |
setTile(Point3D location,
Tile tile)
Sets the tile for the location |
void |
setTileDimension(java.awt.Dimension dimension)
Set the size of the tiles in pixels |
void |
setTileSet(GraphicalObject object)
Sets the GraphicalObject that contains the tiles |
void |
setTileValues(Point3D location,
Sprite spriteDisplayed,
int treadableValue,
int[] elevation)
Sets the values of a tile. |
java.lang.String |
toString()
Make this map to a string. |
Point3D |
unProject(int x,
int y)
Unprojects coordinates from pixel space to tile space. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public java.lang.String mLink
public static final int[][][] viewArea
public Point3D camera
public Point3D screenStart
public java.awt.Dimension screenTileDimension
Constructor Detail |
public Map(int width, int height)
width
- The width of the gaming groundheight
- The height of the gaming groundpublic Map(int width, int height, java.lang.String name)
width
- The width of the gaming groundheight
- The height of the gaming groundMethod Detail |
public java.lang.String getName()
public void setSubWorld(java.lang.String subWorld, Point3D location, Point3D enterLocation)
subWorld
- the name of the subWorld (map). The name
should be in GlobalMapUtilities (i.e. load the maps with GlobalMapUtilities.getInstance().loadMapFromFile())public void setTile(Point3D location, Tile tile)
location
- The location to set the tile fortile
- The tile to setpublic Tile getTile(Point3D location)
location
- The location to get the tile for
public java.awt.Dimension getTileDimension()
public void setTileDimension(java.awt.Dimension dimension)
public boolean canWalkOnTile(Point3D tileCoordinate)
tileCoordinate
- The coordinate of the tile to walk on
public int coordinateCheck(Point3D pos)
pos
- The position on the map to check
public java.awt.Point project(Point3D coordinate)
public Point3D unProject(int x, int y)
x
- The x-coordinatey
- The y-coordinate
public void setTileValues(Point3D location, Sprite spriteDisplayed, int treadableValue, int[] elevation)
spriteDisplayed
- the sprite that the tile haselevation
- the elevation of the tilepublic void setTileSet(GraphicalObject object)
object
- the GraphicalObjectpublic java.awt.Dimension getDimension()
public java.lang.String toString()
public boolean isOnMap(Point3D coordinate)
coordinate
- The coordinate to check
public boolean isOnMap(int x, int y)
x
- The x-coordinate to checky
- The y-coordinate to check
public void optimize()
public void setFogOfWar(Point3D middleLocation, boolean value)
middleLocation
- The location in the middle of the fogvalue
- the value to setpublic void centerCameraOn(Point3D location)
public void paintComponent(java.awt.Graphics2D g, int windowWidth, int windowHeight)
g
- The graphics to use when paintingwindowWidth
- The width of the window to draw inwindowHeight
- The height of the window to draw inpublic void paintBackground(java.awt.Graphics2D g, int windowWidth, int windowHeight)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |