Viewport
in package
Table of Contents
Properties
- $aabb : AABB2D
- AABB of the viewport
- $bottom : float
- $height : float
- Viewport height
- $left : float
- $right : float
- $screenSpaceHeight : float
- $screenSpaceWidth : float
- $top : float
- $width : float
- Viewport width
Methods
- __construct() : mixed
- Constructs a new viewport
- contains() : bool
- Returns boolean indicating if the given point is inside the viewport
- containsAABB() : bool
- Returns boolean indicating if the given AABB is inside the viewport
- getAspectRatio() : float
- Returns the aspect ratio of the viewport
- getBottomCenter() : Vec2
- Returns the bottom center of the viewport
- getBottomLeft() : Vec2
- Returns the bottom left corner of the viewport
- getBottomRight() : Vec2
- Returns the bottom right corner of the viewport
- getCenter() : Vec2
- Returns the center of the viewport
- getHeight() : float
- Returns the absolute height of the viewport, the "height" can be negative If your viewport is flipped, you can use this method to get the absolute height
- getLeftCenter() : Vec2
- Returns the left center of the viewport
- getRightCenter() : Vec2
- Returns the right center of the viewport
- getTopCenter() : Vec2
- Returns the top center of the viewport
- getTopLeft() : Vec2
- Returns the top left corner of the viewport
- getTopRight() : Vec2
- Returns the top right corner of the viewport
- getWidth() : float
- Returns the absolute width of the viewport, the "width" can be negative If your viewport is flipped, you can use this method to get the absolute width
- screenSpaceToViewSpace() : Vec2
- Converts the given screen space point to viewport space
- viewSpaceToScreenSpace() : Vec2
- Converts the given viewport space point to screen space
Properties
$aabb read-only
AABB of the viewport
public
AABB2D
$aabb
$bottom read-only
public
float
$bottom
$height read-only
Viewport height
public
float
$height
$left read-only
public
float
$left
$right read-only
public
float
$right
$screenSpaceHeight read-only
public
float
$screenSpaceHeight
$screenSpaceWidth read-only
public
float
$screenSpaceWidth
$top read-only
public
float
$top
$width read-only
Viewport width
public
float
$width
Methods
__construct()
Constructs a new viewport
public
__construct(float $left, float $right, float $bottom, float $top, float $screenSpaceWidth, float $screenSpaceHeight) : mixed
Parameters
- $left : float
- $right : float
- $bottom : float
- $top : float
- $screenSpaceWidth : float
- $screenSpaceHeight : float
contains()
Returns boolean indicating if the given point is inside the viewport
public
contains(Vec2 $point) : bool
Parameters
- $point : Vec2
Return values
boolcontainsAABB()
Returns boolean indicating if the given AABB is inside the viewport
public
containsAABB(AABB2D $aabb) : bool
Parameters
- $aabb : AABB2D
Return values
boolgetAspectRatio()
Returns the aspect ratio of the viewport
public
getAspectRatio() : float
Return values
floatgetBottomCenter()
Returns the bottom center of the viewport
public
getBottomCenter() : Vec2
Return values
Vec2getBottomLeft()
Returns the bottom left corner of the viewport
public
getBottomLeft() : Vec2
Return values
Vec2getBottomRight()
Returns the bottom right corner of the viewport
public
getBottomRight() : Vec2
Return values
Vec2getCenter()
Returns the center of the viewport
public
getCenter() : Vec2
Return values
Vec2getHeight()
Returns the absolute height of the viewport, the "height" can be negative If your viewport is flipped, you can use this method to get the absolute height
public
getHeight() : float
Return values
floatgetLeftCenter()
Returns the left center of the viewport
public
getLeftCenter() : Vec2
Return values
Vec2getRightCenter()
Returns the right center of the viewport
public
getRightCenter() : Vec2
Return values
Vec2getTopCenter()
Returns the top center of the viewport
public
getTopCenter() : Vec2
Return values
Vec2getTopLeft()
Returns the top left corner of the viewport
public
getTopLeft() : Vec2
Return values
Vec2getTopRight()
Returns the top right corner of the viewport
public
getTopRight() : Vec2
Return values
Vec2getWidth()
Returns the absolute width of the viewport, the "width" can be negative If your viewport is flipped, you can use this method to get the absolute width
public
getWidth() : float
Return values
floatscreenSpaceToViewSpace()
Converts the given screen space point to viewport space
public
screenSpaceToViewSpace(Vec2 $point) : Vec2
Parameters
- $point : Vec2
Return values
Vec2viewSpaceToScreenSpace()
Converts the given viewport space point to screen space
public
viewSpaceToScreenSpace(Vec2 $point) : Vec2
Parameters
- $point : Vec2