Interface IViewport
- 
- All Known Implementing Classes:
- AbstractViewport,- ViewportJ2D,- ViewportJOGL
 
 public interface IViewportThis class manages the GUI and all user interaction.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddViewportListener(IViewportListener listener)Adds a IViewportListenervoiddispose()Disposes the Viewport.voiddrawPrimitive(DrawableCombiner dc, Primitive primitive, java.lang.Object obj)Draws a primitiveIVector2getAreaSize()Gets the maximum displayable size.java.awt.CanvasgetCanvas()Returns the canvas that is used for displaying the objects.booleangetInvertX()Returns true if the x-axis is inverted (right-left instead of left-right).booleangetInvertY()Returns true if the y-axis is inverted (top-down instead of bottom-up).IPerspectivegetPerspective()Get the perspective.IVector2getPosition()Gets the position of the viewport.IVector2getSize()Gets the size of the display area.ISpaceControllergetSpaceController()IVector2getWorldCoordinates(int pixelX, int pixelY)Converts pixel coordinates into world coordinatesbooleanisShowing()Checks if this IViewport is showing on screen.voidrefresh()Refreshes the viewport.voidrefreshCanvasSize()Refreshes the size of the canvas.voidremoveViewportListener(IViewportListener listener)Removes a IViewportListenervoidsetAreaSize(IVector2 areaSize)Sets the maximum displayable size.voidsetBackground(java.awt.Color bgColor)Sets the background color.voidsetInvertX(boolean b)If set to true, inverts the x-axis (right-left instead of left-right).voidsetInvertY(boolean b)If set to true, inverts the y-axis (top-down instead of bottom-up).voidsetObjectList(java.util.List objectList)Sets the current objects to draw.voidsetObjectShift(IVector2 objectShift)Sets the shift of all objects.voidsetPosition(IVector2 pos)Sets the position of the bottom left corner of the viewport.voidsetPostLayers(Layer[] layer)Sets the layers that are applied after the drawables are drawn.voidsetPreLayers(Layer[] layer)Sets the layers that are applied before the drawables are drawn.voidsetPreserveAspectRation(boolean preserveAR)Sets whether the viewport should preserve the aspect ratio of the size by padding.voidsetSize(IVector2 size)Sets the viewport size.voidsetZoomLimit(double zoomlimit)Sets the maximum zoom.
 
- 
- 
- 
Method Detail- 
getSpaceControllerISpaceController getSpaceController() - Returns:
- the spacecontroller
 
 - 
getPositionIVector2 getPosition() Gets the position of the viewport.
 - 
setPositionvoid setPosition(IVector2 pos) Sets the position of the bottom left corner of the viewport.
 - 
setBackgroundvoid setBackground(java.awt.Color bgColor) Sets the background color.- Parameters:
- bgColor- the background color
 
 - 
getAreaSizeIVector2 getAreaSize() Gets the maximum displayable size.- Returns:
- maximum area size.
 
 - 
getSizeIVector2 getSize() Gets the size of the display area.- Returns:
- size of the display area, may be padded to preserve aspect ratio
 
 - 
setSizevoid setSize(IVector2 size) Sets the viewport size.- Parameters:
- size- new viewport size
 
 - 
setAreaSizevoid setAreaSize(IVector2 areaSize) Sets the maximum displayable size.- Parameters:
- areaSize- maximum area size.
 
 - 
refreshCanvasSizevoid refreshCanvasSize() Refreshes the size of the canvas.
 - 
setPreserveAspectRationvoid setPreserveAspectRation(boolean preserveAR) Sets whether the viewport should preserve the aspect ratio of the size by padding.- Parameters:
- preserveAR- true to preserve aspect ratio, false otherwise
 
 - 
setObjectShiftvoid setObjectShift(IVector2 objectShift) Sets the shift of all objects.
 - 
getInvertXboolean getInvertX() Returns true if the x-axis is inverted (right-left instead of left-right).- Returns:
- true, if the x-axis is inverted
 
 - 
getInvertYboolean getInvertY() Returns true if the y-axis is inverted (top-down instead of bottom-up).- Returns:
- true, if the y-axis is inverted
 
 - 
setInvertXvoid setInvertX(boolean b) If set to true, inverts the x-axis (right-left instead of left-right).- Parameters:
- b- if true, inverts the x-axis
 
 - 
setInvertYvoid setInvertY(boolean b) If set to true, inverts the y-axis (top-down instead of bottom-up).- Parameters:
- b- if true, inverts the y-axis
 
 - 
setPreLayersvoid setPreLayers(Layer[] layer) Sets the layers that are applied before the drawables are drawn.- Parameters:
- layers- new layers
 
 - 
setPostLayersvoid setPostLayers(Layer[] layer) Sets the layers that are applied after the drawables are drawn.- Parameters:
- layers- new layers
 
 - 
setObjectListvoid setObjectList(java.util.List objectList) Sets the current objects to draw.- Parameters:
- objectList- objects that should be drawn
 
 - 
setZoomLimitvoid setZoomLimit(double zoomlimit) Sets the maximum zoom.- Parameters:
- zoomlimit- the zoom limit
 
 - 
getCanvasjava.awt.Canvas getCanvas() Returns the canvas that is used for displaying the objects.
 - 
refreshvoid refresh() Refreshes the viewport.
 - 
isShowingboolean isShowing() Checks if this IViewport is showing on screen.- Returns:
- true if the IViewport is showing, false otherwise
 
 - 
getWorldCoordinatesIVector2 getWorldCoordinates(int pixelX, int pixelY) Converts pixel coordinates into world coordinates- Parameters:
- pixelX- pixel x-coordinate
- pixelY- pixel y-coordinate
- Returns:
- world coordinates
 
 - 
addViewportListenervoid addViewportListener(IViewportListener listener) Adds a IViewportListener- Parameters:
- listener- new listener
 
 - 
removeViewportListenervoid removeViewportListener(IViewportListener listener) Removes a IViewportListener- Parameters:
- listener- the listener
 
 - 
getPerspectiveIPerspective getPerspective() Get the perspective.- Returns:
- The perspective.
 
 - 
drawPrimitivevoid drawPrimitive(DrawableCombiner dc, Primitive primitive, java.lang.Object obj) Draws a primitive- Parameters:
- dc- The combiner.
- primitive- The primitive.
- obj- The object being drawn.
 
 - 
disposevoid dispose() Disposes the Viewport.
 
- 
 
-