|
||||||||||
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.LayerViewer
public class LayerViewer
Renders a Layer
of a Map
onto the screen. This
class may be used independently (or even without) a MapViewer
.
See MapViewer
for a discussion on offsets.
Field Summary |
---|
Fields inherited from class com.alienfactory.javamappy.viewer.Viewer |
---|
mapHeader, pillarRiserMode, pixelX, pixelY, renderer, viewHeight, viewOffsetX, viewOffsetY, viewWidth |
Constructor Summary | |
---|---|
LayerViewer(Layer layer,
MapHeader mapHeader,
Renderer renderer,
int viewWidth,
int viewHeight)
Creates a LayerViewer and places the viewing area at the
top left corner. |
|
LayerViewer(Layer layer,
MapHeader mapHeader,
Renderer renderer,
int viewWidth,
int viewHeight,
int viewOffsetX,
int viewOffsetY)
Creates a LayerViewer and places the viewing area at the
given offset. |
Method Summary | |
---|---|
int |
calculateTallestPillar()
Calculates the height of the tallest pillar - used when drawing Isometric maps with Pillar Riser Mode turned on. |
void |
draw(java.lang.Object objGFX,
boolean transparency)
Renders the Background and Foreground layers of all the visible blocks onto the screen. |
void |
draw(java.lang.Object objGFX,
boolean transparency,
int x,
int y,
int width,
int height)
Renders a partial area of the Layer using the given GFX object. |
void |
drawBackground(java.lang.Object objGFX,
boolean transparency)
Renders the background layer of all the visible block onto the screen. |
void |
drawBackground(java.lang.Object objGFX,
boolean transparency,
int x,
int y,
int width,
int height)
|
void |
drawForeground(java.lang.Object objGfx,
int blockLayer)
Renders a foreground layer of all the visible blocks onto the screen. |
void |
drawForeground(java.lang.Object objGfx,
int blockLayer,
int x,
int y,
int width,
int height)
|
Layer |
getLayer()
Returns the Layer associated with this Viewer. |
Methods inherited from class com.alienfactory.javamappy.viewer.Viewer |
---|
addBlockX, addBlockY, addPixelX, addPixelY, getBlockX, getBlockY, getMapHeader, getPixelX, getPixelY, getRenderer, getViewHeight, getViewOffsetX, getViewOffsetY, getViewWidth, isPillarRiserMode, setBlockX, setBlockY, setPillarRiserMode, setPixelX, setPixelY, 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 LayerViewer(Layer layer, MapHeader mapHeader, Renderer renderer, int viewWidth, int viewHeight)
LayerViewer
and places the viewing area at the
top left corner.
layer
- the Layer
to be viewedmapHeader
- contains useful informationrenderer
- the Renderer
to use when drawing the mapviewWidth
- the width of the viewing area in pixelsviewHeight
- the height of the viewing area in pixelspublic LayerViewer(Layer layer, MapHeader mapHeader, Renderer renderer, int viewWidth, int viewHeight, int viewOffsetX, int viewOffsetY)
LayerViewer
and places the viewing area at the
given offset.
layer
- the Layer
to be viewedmapHeader
- contains useful informationrenderer
- 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 int calculateTallestPillar()
public void drawBackground(java.lang.Object objGFX, boolean transparency)
objGFX
- the gfx object specific to the Renderer
transparency
- whether or not the layer should be rendered using
their transparent pixelspublic void drawBackground(java.lang.Object objGFX, boolean transparency, int x, int y, int width, int height) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void drawForeground(java.lang.Object objGfx, int blockLayer) throws java.lang.IllegalArgumentException
objGfx
- the gfx object specific to the Renderer
blockLayer
- the foreground layer to render
java.lang.IllegalArgumentException
- if blockLayer
is out of
bounds or objGfx is null
public void drawForeground(java.lang.Object objGfx, int blockLayer, int x, int y, int width, int height) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
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 Layer getLayer()
Layer
associated with this Viewer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |