VISU - PHP Game Framework

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

$height read-only

Viewport height

public float $height

$screenSpaceHeight read-only

public float $screenSpaceHeight

$screenSpaceWidth read-only

public float $screenSpaceWidth

$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
bool

containsAABB()

Returns boolean indicating if the given AABB is inside the viewport

public containsAABB(AABB2D $aabb) : bool
Parameters
$aabb : AABB2D
Return values
bool

getAspectRatio()

Returns the aspect ratio of the viewport

public getAspectRatio() : float
Return values
float

getBottomCenter()

Returns the bottom center of the viewport

public getBottomCenter() : Vec2
Return values
Vec2

getBottomLeft()

Returns the bottom left corner of the viewport

public getBottomLeft() : Vec2
Return values
Vec2

getBottomRight()

Returns the bottom right corner of the viewport

public getBottomRight() : Vec2
Return values
Vec2

getCenter()

Returns the center of the viewport

public getCenter() : Vec2
Return values
Vec2

getHeight()

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
float

getLeftCenter()

Returns the left center of the viewport

public getLeftCenter() : Vec2
Return values
Vec2

getRightCenter()

Returns the right center of the viewport

public getRightCenter() : Vec2
Return values
Vec2

getTopCenter()

Returns the top center of the viewport

public getTopCenter() : Vec2
Return values
Vec2

getTopLeft()

Returns the top left corner of the viewport

public getTopLeft() : Vec2
Return values
Vec2

getTopRight()

Returns the top right corner of the viewport

public getTopRight() : Vec2
Return values
Vec2

getWidth()

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
float

screenSpaceToViewSpace()

Converts the given screen space point to viewport space

public screenSpaceToViewSpace(Vec2 $point) : Vec2
Parameters
$point : Vec2
Return values
Vec2

viewSpaceToScreenSpace()

Converts the given viewport space point to screen space

public viewSpaceToScreenSpace(Vec2 $point) : Vec2
Parameters
$point : Vec2
Return values
Vec2

        
On this page

Search results