Package org.jbox2d.common
Interface IViewportTransform
-
- All Known Implementing Classes:
OBBViewportTransform
public interface IViewportTransformThis is the viewport transform used from drawing. Use yFlip if you are drawing from the top-left corner.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Vec2getCenter()center of the viewport.Vec2getExtents()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.voidsetCenter(Vec2 argPos)sets 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 Detail
-
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-
-
-