|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alienfactory.javamappy.viewer.Viewer
public abstract class Viewer
Renders a Map
or a Layer
(dependent on the concrete
implementation) onto the screen. By default the map is rendered to the top
left hand corner of the screen as shown below:
+------------------+---------+ | | | | JavaMappy Viewer | | | | | | | | +------------------+ | | | | Screen | | | +----------------------------+(A
Viewer
with a width and height smaller than the screen) +----------------------------+ | Screen | | +------------------+ | | | | | | | JavaMappy Viewer | | | | | | | | | | | +------------------+ | | | +----------------------------+(The same
Viewer
with an X and Y offset)
Field Summary | |
---|---|
protected MapHeader |
mapHeader
|
protected boolean |
pillarRiserMode
|
protected int |
pixelX
|
protected int |
pixelY
|
protected Renderer |
renderer
|
protected int |
viewHeight
|
protected int |
viewOffsetX
|
protected int |
viewOffsetY
|
protected int |
viewWidth
|
Constructor Summary | |
---|---|
Viewer(MapHeader mapHeader,
Renderer renderer,
int viewWidth,
int viewHeight,
int viewOffsetX,
int viewOffsetY)
Creates a Viewer 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. |
abstract void |
draw(java.lang.Object objGFX,
boolean transparency)
Draws Mappy data into the viewing area. |
abstract void |
draw(java.lang.Object objGFX,
boolean transparency,
int x,
int y,
int width,
int height)
Draws but just a section of the viewing area. |
int |
getBlockX()
Returns the X coordinate in blocks of the top left hand corner of the viewing area. |
int |
getBlockY()
Returns the Y coordinate in blocks of the top left hand corner of the viewing area. |
MapHeader |
getMapHeader()
Returns the MapHeader associated with this Viewer. |
int |
getPixelX()
Returns the X coordinate in pixels of the top left hand corner of the viewing area. |
int |
getPixelY()
Returns the Y coordinate in pixels of the top left hand corner of the viewing area. |
Renderer |
getRenderer()
Returns the Renderer associated with this Viewer. |
int |
getViewHeight()
Returns the height in pixels of the viewing area. |
int |
getViewOffsetX()
Returns the horizontal offset in pixels of the viewing area from the top left hand corner of the screen. |
int |
getViewOffsetY()
Returns the vertical offset in pixels of the viewing area from the top left hand corner of the screen. |
int |
getViewWidth()
Returns the width in pixels of the viewing area. |
boolean |
isPillarRiserMode()
Returns true is this viewer is in Pillar Riser Mode, used in
isometric maps. |
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 |
setViewHeight(int viewHeight)
Sets the height in pixels of the viewing area. |
void |
setViewOffsetX(int viewOffsetX)
Sets the horizontal offset in pixels of the viewing area from the top left hand corner of the screen. |
void |
setViewOffsetY(int viewOffsetY)
Sets the vertical offset in pixels of the viewing area from the top left hand corner of the screen. |
void |
setViewWidth(int viewWidth)
Sets the width in pixels of the viewing area. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final MapHeader mapHeader
protected final Renderer renderer
protected int viewWidth
protected int viewHeight
protected int viewOffsetX
protected int viewOffsetY
protected int pixelX
protected int pixelY
protected boolean pillarRiserMode
Constructor Detail |
---|
public Viewer(MapHeader mapHeader, Renderer renderer, int viewWidth, int viewHeight, int viewOffsetX, int viewOffsetY) throws java.lang.IllegalArgumentException
Viewer
and places the viewing area at the given
offset.
mapHeader
- contains useful informationrenderer
- the Renderer
to use when drawingviewWidth
- 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 screen
java.lang.IllegalArgumentException
Method Detail |
---|
public int getViewWidth()
public void setViewWidth(int viewWidth) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if viewWidth is less than or equal to zeropublic int getViewHeight()
public void setViewHeight(int viewHeight) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if viewWidth is less than or equal to zeropublic int getViewOffsetX()
public void setViewOffsetX(int viewOffsetX) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if viewOffsetX is less than zeropublic int getViewOffsetY()
public void setViewOffsetY(int viewOffsetY) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if viewOffsetX is less than zeropublic Renderer getRenderer()
Renderer
associated with this Viewer. This method
should not return null
.
public MapHeader getMapHeader()
MapHeader
associated with this Viewer. This method
should not return null
.
public boolean isPillarRiserMode()
true
is this viewer is in Pillar Riser Mode, used in
isometric maps.
public void setPillarRiserMode(boolean pillarRiserMode)
public int getPixelX()
public void setPixelX(int pixelX)
pixelX
- the new X coordinate in pixelspublic void addPixelX(int deltaX)
deltaX
- the amount to add to the X coordinate in pixelspublic int getPixelY()
public void setPixelY(int pixelY)
pixelY
- the new Y coordinate in pixelspublic void addPixelY(int deltaY)
deltaY
- the amount to add to the Y coordinate in pixelspublic int getBlockX()
public void setBlockX(int blockX)
blockX
- the new X coordinate in blockspublic void addBlockX(int blockX)
blockX
- the amount to add to the X coordinate in blockspublic int getBlockY()
public void setBlockY(int blockY)
blockY
- the new Y coordinate in blockspublic void addBlockY(int blockY)
blockY
- the amount to add to the Y coordinate in blockspublic abstract void draw(java.lang.Object objGFX, boolean transparency)
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 abstract void draw(java.lang.Object objGFX, boolean transparency, int x, int y, int width, int height)
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 render
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |