public interface IViewportTransform

Known subtypesOBBViewportTransform

This is the viewport transform used from drawing. Use yFlip if you are drawing from the top-left corner.

Methods

public abstract boolean isYFlip()
public abstract void setYFlip(boolean yFlip)
public abstract Vec2 getExtents()This is the half-width and half-height.
public abstract void setExtents(Vec2 argExtents)This sets the half-width and half-height.
public abstract void setExtents(float argHalfWidth, float argHalfHeight)This sets the half-width and half-height of the viewport.
public abstract Vec2 getCenter()center of the viewport.
public abstract void setCenter(Vec2 argPos)sets the center of the viewport.
public abstract void setCenter(float x, float y)sets the center of the viewport.
public abstract 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.
public abstract void getWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen)Transforms the given directional vector by the viewport transform (not positional)
public abstract void getScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld)Transforms the given directional screen vector back to the world direction.
public abstract void getWorldToScreen(Vec2 argWorld, Vec2 argScreen)takes the world coordinate (argWorld) puts the corresponding screen coordinate in argScreen.
public abstract void getScreenToWorld(Vec2 argScreen, Vec2 argWorld)takes the screen coordinates (argScreen) and puts the corresponding world coordinates in argWorld.

Method details

isYFlip

public abstract boolean isYFlip()

Returns

if the transform flips the y axis

setYFlip

public abstract void setYFlip(boolean yFlip)

Parameters

yFlip boolean
if we flip the y axis when transforming

getExtents

public abstract 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.

setExtents

public abstract 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.

setExtents

public abstract 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.

getCenter

public abstract Vec2 getCenter()
center of the viewport. Not a copy.

setCenter

public abstract void setCenter(Vec2 argPos)
sets the center of the viewport.

setCenter

public abstract void setCenter(float x, float y)
sets the center of the viewport.

setCamera

public abstract 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.

getWorldVectorToScreen

public abstract void getWorldVectorToScreen(Vec2 argWorld, Vec2 argScreen)
Transforms the given directional vector by the viewport transform (not positional)

getScreenVectorToWorld

public abstract void getScreenVectorToWorld(Vec2 argScreen, Vec2 argWorld)
Transforms the given directional screen vector back to the world direction.

getWorldToScreen

public abstract 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.

getScreenToWorld

public abstract 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.