Interface IViewportTransform

All Known Implementing Classes:
OBBViewportTransform

public interface IViewportTransform
This is the viewport transform used from drawing. Use yFlip if you are drawing from the top-left corner.
  • Method Summary

    Modifier and Type
    Method
    Description
    center of the viewport.
    This is the half-width and half-height.
    void
    getScreenToWorld(Vec2 argScreen, Vec2 argWorld)
    takes the screen coordinates (argScreen) and puts the corresponding world coordinates in argWorld.
    void
    getScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld)
    Transforms the given directional screen vector back to the world direction.
    void
    getWorldToScreen(Vec2 argWorld, Vec2 argScreen)
    takes the world coordinate (argWorld) puts the corresponding screen coordinate in argScreen.
    void
    getWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen)
    Transforms the given directional vector by the viewport transform (not positional)
    boolean
     
    void
    setCamera(float x, float y, float scale)
    Sets the transform's center to the given x and y coordinates, and using the given scale.
    void
    setCenter(float x, float y)
    sets the center of the viewport.
    void
    setCenter(Vec2 argPos)
    sets the center of the viewport.
    void
    setExtents(float argHalfWidth, float argHalfHeight)
    This sets the half-width and half-height of the viewport.
    void
    setExtents(Vec2 argExtents)
    This sets the half-width and half-height.
    void
    setYFlip(boolean yFlip)
     
  • Method Details

    • isYFlip

      boolean isYFlip()
      Returns:
      if the transform flips the y axis
    • setYFlip

      void setYFlip(boolean yFlip)
      Parameters:
      yFlip - if we flip the y axis when transforming
    • getExtents

      Vec2 getExtents()
      This is the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled. Not a copy.
      Returns:
    • setExtents

      void setExtents(Vec2 argExtents)
      This sets the half-width and half-height. This should be the actual half-width and half-height, not anything transformed or scaled.
      Parameters:
      argExtents -
    • setExtents

      void setExtents(float argHalfWidth, float argHalfHeight)
      This sets the half-width and half-height of the viewport. This should be the actual half-width and half-height, not anything transformed or scaled.
      Parameters:
      argHalfWidth -
      argHalfHeight -
    • getCenter

      Vec2 getCenter()
      center of the viewport. Not a copy.
      Returns:
    • setCenter

      void setCenter(Vec2 argPos)
      sets the center of the viewport.
      Parameters:
      argPos -
    • setCenter

      void setCenter(float x, float y)
      sets the center of the viewport.
      Parameters:
      x -
      y -
    • setCamera

      void setCamera(float x, float y, float scale)
      Sets the transform's center to the given x and y coordinates, and using the given scale.
      Parameters:
      x -
      y -
      scale -
    • getWorldVectorToScreen

      void getWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen)
      Transforms the given directional vector by the viewport transform (not positional)
      Parameters:
      argVec -
      argOut -
    • getScreenVectorToWorld

      void getScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld)
      Transforms the given directional screen vector back to the world direction.
      Parameters:
      argVec -
      argOut -
    • getWorldToScreen

      void getWorldToScreen(Vec2 argWorld, Vec2 argScreen)
      takes the world coordinate (argWorld) puts the corresponding screen coordinate in argScreen. It should be safe to give the same object as both parameters.
      Parameters:
      argWorld -
      argScreen -
    • getScreenToWorld

      void getScreenToWorld(Vec2 argScreen, Vec2 argWorld)
      takes the screen coordinates (argScreen) and puts the corresponding world coordinates in argWorld. It should be safe to give the same object as both parameters.
      Parameters:
      argScreen -
      argWorld -