|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alienfactory.javamappy.viewer.Viewer
com.alienfactory.javamappy.viewer.MapViewer
public class MapViewer
Renders a Map
onto the screen. A MapViewer
creates
a LayerViewer
for each of the Layers
in the
Map
.
Updating the coordinates of a MapViewer
also updates the
coordinates of all the underlying LayerViewers
.
Note that the coordinates of a MapViewer
are held independently
of the coordinates held by the underlying LayerViewers
. i.e. If
you were to change the coordinates of the LayerViewers
, the
coordinates held by the MapViewer
would remain unchanged.
Field Summary |
---|
Fields inherited from class com.alienfactory.javamappy.viewer.Viewer |
---|
mapHeader, pillarRiserMode, pixelX, pixelY, renderer, viewHeight, viewOffsetX, viewOffsetY, viewWidth |
Constructor Summary | |
---|---|
MapViewer(Map map,
Renderer renderer,
int viewWidth,
int viewHeight)
Creates a LayerViewer for each of the Layers in the
Map . |
|
MapViewer(Map map,
Renderer renderer,
int viewWidth,
int viewHeight,
int viewOffsetX,
int viewOffsetY)
Creates a LayerViewer for each of the Layers in the
Map and places the viewing area at the given offset. |
Method Summary | |
---|---|
void |
addBlockX(int blockX)
Increments the X coordinate by the given block amount. |
void |
addBlockY(int blockY)
Increments the Y coordinate by the given block amount. |
void |
addPixelX(int deltaX)
Increments the X coordinate by the given pixel amount. |
void |
addPixelY(int deltaY)
Increments the Y coordinate by the given pixel amount. |
void |
draw(java.lang.Object objGFX,
boolean transparency)
Renders the Map using the given GFX object. |
void |
draw(java.lang.Object objGFX,
boolean transparency,
int x,
int y,
int width,
int height)
Renders a partial area of the Map using the given GFX object. |
LayerViewer[] |
getLayerViewers()
Returns an array of LayerViewer s. |
Map |
getMap()
Returns the Map associated with this viewer. |
void |
setBlockX(int blockX)
Sets the X coordinate in blocks of the top left hand corner of the viewing area. |
void |
setBlockY(int blockY)
Sets the Y coordinate in blocks of the top left hand corner of the viewing area. |
void |
setPillarRiserMode(boolean pillarRiserMode)
Sets the Pillar Riser Mode, as used in isometric maps. |
void |
setPixelX(int pixelX)
Sets the X coordinate in pixels of the top left hand corner of the viewing area. |
void |
setPixelY(int pixelY)
Sets the Y coordinate in pixels of the top left hand corner of the viewing area. |
void |
updateAnimBlocks()
A helper method that updates the animation of all the AnimBlocks in the
Map . |
Methods inherited from class com.alienfactory.javamappy.viewer.Viewer |
---|
getBlockX, getBlockY, getMapHeader, getPixelX, getPixelY, getRenderer, getViewHeight, getViewOffsetX, getViewOffsetY, getViewWidth, isPillarRiserMode, setViewHeight, setViewOffsetX, setViewOffsetY, setViewWidth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapViewer(Map map, Renderer renderer, int viewWidth, int viewHeight)
LayerViewer
for each of the Layers
in the
Map
. The viewing area defaults to the top left hand corner
of the screen.
map
- the Map
to be viewedrenderer
- the Renderer
to use when drawing the mapviewWidth
- the width of the viewing area in pixelsviewHeight
- the height of the viewing area in pixelspublic MapViewer(Map map, Renderer renderer, int viewWidth, int viewHeight, int viewOffsetX, int viewOffsetY)
LayerViewer
for each of the Layers
in the
Map
and places the viewing area at the given offset.
map
- the Map
to be viewedrenderer
- the Renderer
to use when drawing the mapviewWidth
- the width of the viewing area in pixelsviewHeight
- the height of the viewing area in pixelsviewOffsetX
- the initial offset in pixels of the viewing area
from the top left hand corner of the screenviewOffsetY
- the initial offset in pixels of the viewing area
from the top left hand corner of the screenMethod Detail |
---|
public LayerViewer[] getLayerViewers()
LayerViewer
s.
public Map getMap()
Map
associated with this viewer.
public void setPixelX(int pixelX)
Viewer
setPixelX
in class Viewer
pixelX
- the new X coordinate in pixelspublic void addPixelX(int deltaX)
Viewer
addPixelX
in class Viewer
deltaX
- the amount to add to the X coordinate in pixelspublic void setPixelY(int pixelY)
Viewer
setPixelY
in class Viewer
pixelY
- the new Y coordinate in pixelspublic void addPixelY(int deltaY)
Viewer
addPixelY
in class Viewer
deltaY
- the amount to add to the Y coordinate in pixelspublic void setBlockX(int blockX)
Viewer
setBlockX
in class Viewer
blockX
- the new X coordinate in blockspublic void addBlockX(int blockX)
Viewer
addBlockX
in class Viewer
blockX
- the amount to add to the X coordinate in blockspublic void setBlockY(int blockY)
Viewer
setBlockY
in class Viewer
blockY
- the new Y coordinate in blockspublic void addBlockY(int blockY)
Viewer
addBlockY
in class Viewer
blockY
- the amount to add to the Y coordinate in blockspublic void updateAnimBlocks()
AnimBlocks
in the
Map
.
public void draw(java.lang.Object objGFX, boolean transparency)
draw
in class Viewer
objGFX
- the gfx object specific to the Renderer
transparency
- whether or not the background layer of the blocks
should be rendered honouring their transparent pixelspublic void draw(java.lang.Object objGFX, boolean transparency, int x, int y, int width, int height)
draw
in class Viewer
x
- the pixel x coordinate from the left hand side of the viewing areay
- the pixel y coordinate from the top of the viewing areawidth
- the width, in pixels, of the viewing area to renderheight
- the height, in pixels, of the viewing area to renderpublic void setPillarRiserMode(boolean pillarRiserMode)
Viewer
setPillarRiserMode
in class Viewer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |