public interface IViewport
Modifier and Type | Method and Description |
---|---|
void |
addViewportListener(IViewportListener listener)
Adds a IViewportListener
|
void |
dispose()
Disposes the Viewport.
|
void |
drawPrimitive(DrawableCombiner dc,
Primitive primitive,
java.lang.Object obj)
Draws a primitive
|
IVector2 |
getAreaSize()
Gets the maximum displayable size.
|
java.awt.Canvas |
getCanvas()
Returns the canvas that is used for displaying the objects.
|
boolean |
getInvertX()
Returns true if the x-axis is inverted (right-left instead of
left-right).
|
boolean |
getInvertY()
Returns true if the y-axis is inverted (top-down instead of bottom-up).
|
IPerspective |
getPerspective()
Get the perspective.
|
IVector2 |
getPosition()
Gets the position of the viewport.
|
IVector2 |
getSize()
Gets the size of the display area.
|
ISpaceController |
getSpaceController() |
IVector2 |
getWorldCoordinates(int pixelX,
int pixelY)
Converts pixel coordinates into world coordinates
|
boolean |
isShowing()
Checks if this IViewport is showing on screen.
|
void |
refresh()
Refreshes the viewport.
|
void |
refreshCanvasSize()
Refreshes the size of the canvas.
|
void |
removeViewportListener(IViewportListener listener)
Removes a IViewportListener
|
void |
setAreaSize(IVector2 areaSize)
Sets the maximum displayable size.
|
void |
setBackground(java.awt.Color bgColor)
Sets the background color.
|
void |
setInvertX(boolean b)
If set to true, inverts the x-axis (right-left instead of left-right).
|
void |
setInvertY(boolean b)
If set to true, inverts the y-axis (top-down instead of bottom-up).
|
void |
setObjectList(java.util.List objectList)
Sets the current objects to draw.
|
void |
setObjectShift(IVector2 objectShift)
Sets the shift of all objects.
|
void |
setPosition(IVector2 pos)
Sets the position of the bottom left corner of the viewport.
|
void |
setPostLayers(Layer[] layer)
Sets the layers that are applied after the drawables are drawn.
|
void |
setPreLayers(Layer[] layer)
Sets the layers that are applied before the drawables are drawn.
|
void |
setPreserveAspectRation(boolean preserveAR)
Sets whether the viewport should preserve the aspect ratio of the size by
padding.
|
void |
setSize(IVector2 size)
Sets the viewport size.
|
void |
setZoomLimit(double zoomlimit)
Sets the maximum zoom.
|
ISpaceController getSpaceController()
IVector2 getPosition()
void setPosition(IVector2 pos)
void setBackground(java.awt.Color bgColor)
bgColor
- the background colorIVector2 getAreaSize()
IVector2 getSize()
void setSize(IVector2 size)
size
- new viewport sizevoid setAreaSize(IVector2 areaSize)
areaSize
- maximum area size.void refreshCanvasSize()
void setPreserveAspectRation(boolean preserveAR)
preserveAR
- true to preserve aspect ratio, false otherwisevoid setObjectShift(IVector2 objectShift)
boolean getInvertX()
boolean getInvertY()
void setInvertX(boolean b)
b
- if true, inverts the x-axisvoid setInvertY(boolean b)
b
- if true, inverts the y-axisvoid setPreLayers(Layer[] layer)
layers
- new layersvoid setPostLayers(Layer[] layer)
layers
- new layersvoid setObjectList(java.util.List objectList)
objectList
- objects that should be drawnvoid setZoomLimit(double zoomlimit)
zoomlimit
- the zoom limitjava.awt.Canvas getCanvas()
void refresh()
boolean isShowing()
IVector2 getWorldCoordinates(int pixelX, int pixelY)
pixelX
- pixel x-coordinatepixelY
- pixel y-coordinatevoid addViewportListener(IViewportListener listener)
listener
- new listenervoid removeViewportListener(IViewportListener listener)
listener
- the listenerIPerspective getPerspective()
void drawPrimitive(DrawableCombiner dc, Primitive primitive, java.lang.Object obj)
dc
- The combiner.primitive
- The primitive.obj
- The object being drawn.void dispose()