Interface IViewport

    • Method Detail

      • getSpaceController

        ISpaceController getSpaceController()
        Returns:
        the spacecontroller
      • getPosition

        IVector2 getPosition()
        Gets the position of the viewport.
      • setPosition

        void setPosition​(IVector2 pos)
        Sets the position of the bottom left corner of the viewport.
      • setBackground

        void setBackground​(java.awt.Color bgColor)
        Sets the background color.
        Parameters:
        bgColor - the background color
      • getAreaSize

        IVector2 getAreaSize()
        Gets the maximum displayable size.
        Returns:
        maximum area size.
      • getSize

        IVector2 getSize()
        Gets the size of the display area.
        Returns:
        size of the display area, may be padded to preserve aspect ratio
      • setSize

        void setSize​(IVector2 size)
        Sets the viewport size.
        Parameters:
        size - new viewport size
      • setAreaSize

        void setAreaSize​(IVector2 areaSize)
        Sets the maximum displayable size.
        Parameters:
        areaSize - maximum area size.
      • refreshCanvasSize

        void refreshCanvasSize()
        Refreshes the size of the canvas.
      • setPreserveAspectRation

        void 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
      • setObjectShift

        void setObjectShift​(IVector2 objectShift)
        Sets the shift of all objects.
      • getInvertX

        boolean getInvertX()
        Returns true if the x-axis is inverted (right-left instead of left-right).
        Returns:
        true, if the x-axis is inverted
      • getInvertY

        boolean getInvertY()
        Returns true if the y-axis is inverted (top-down instead of bottom-up).
        Returns:
        true, if the y-axis is inverted
      • setInvertX

        void 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
      • setInvertY

        void 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
      • setPreLayers

        void setPreLayers​(Layer[] layer)
        Sets the layers that are applied before the drawables are drawn.
        Parameters:
        layers - new layers
      • setPostLayers

        void setPostLayers​(Layer[] layer)
        Sets the layers that are applied after the drawables are drawn.
        Parameters:
        layers - new layers
      • setObjectList

        void setObjectList​(java.util.List objectList)
        Sets the current objects to draw.
        Parameters:
        objectList - objects that should be drawn
      • setZoomLimit

        void setZoomLimit​(double zoomlimit)
        Sets the maximum zoom.
        Parameters:
        zoomlimit - the zoom limit
      • getCanvas

        java.awt.Canvas getCanvas()
        Returns the canvas that is used for displaying the objects.
      • refresh

        void refresh()
        Refreshes the viewport.
      • isShowing

        boolean isShowing()
        Checks if this IViewport is showing on screen.
        Returns:
        true if the IViewport is showing, false otherwise
      • getWorldCoordinates

        IVector2 getWorldCoordinates​(int pixelX,
                                     int pixelY)
        Converts pixel coordinates into world coordinates
        Parameters:
        pixelX - pixel x-coordinate
        pixelY - pixel y-coordinate
        Returns:
        world coordinates
      • addViewportListener

        void addViewportListener​(IViewportListener listener)
        Adds a IViewportListener
        Parameters:
        listener - new listener
      • removeViewportListener

        void removeViewportListener​(IViewportListener listener)
        Removes a IViewportListener
        Parameters:
        listener - the listener
      • getPerspective

        IPerspective getPerspective()
        Get the perspective.
        Returns:
        The perspective.
      • drawPrimitive

        void drawPrimitive​(DrawableCombiner dc,
                           Primitive primitive,
                           java.lang.Object obj)
        Draws a primitive
        Parameters:
        dc - The combiner.
        primitive - The primitive.
        obj - The object being drawn.
      • dispose

        void dispose()
        Disposes the Viewport.