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 TypeMethodDescriptioncenter of the viewport.This is the half-width and half-height.voidgetScreenToWorld(Vec2 argScreen, Vec2 argWorld) takes the screen coordinates (argScreen) and puts the corresponding world coordinates in argWorld.voidgetScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld) Transforms the given directional screen vector back to the world direction.voidgetWorldToScreen(Vec2 argWorld, Vec2 argScreen) takes the world coordinate (argWorld) puts the corresponding screen coordinate in argScreen.voidgetWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen) Transforms the given directional vector by the viewport transform (not positional)booleanisYFlip()voidsetCamera(float x, float y, float scale) Sets the transform's center to the given x and y coordinates, and using the given scale.voidsetCenter(float x, float y) sets the center of the viewport.voidsets the center of the viewport.voidsetExtents(float argHalfWidth, float argHalfHeight) This sets the half-width and half-height of the viewport.voidsetExtents(Vec2 argExtents) This sets the half-width and half-height.voidsetYFlip(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
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
-
setCenter
-
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
-
getScreenVectorToWorld
-
getWorldToScreen
-
getScreenToWorld
-