VISU - PHP Game Framework

FUIRenderContext
in package

Table of Contents

Properties

$containerSize  : Vec2
The size of the current view
$contentScale  : float
Current content scale factor
$input  : Input
$mousePos  : Vec2
Current cursor position
$origin  : Vec2
Absolute origin of the current view
$theme  : FUITheme
$vg  : VGContext
$deferredRenderQueue  : array<string|int, callable(FUIRenderContext): void>
Queue of deferred render functions to be executed at the end of the frame This allows elements like dropdowns to render on top of other elements
$fontFace  : string
Current font face
$persistentData  : array<string, mixed>
Static data storage for persistent values across frames

Methods

__construct()  : mixed
Initializes the render context
clearAllStaticValues()  : void
Clears all static values
clearStaticValue()  : void
Clears a specific static value
deferRender()  : void
Adds a render function to be executed at the end of the frame This allows elements to render on top of others (z-index control)
ensureFontFace()  : void
Ensures the given font face is set
ensureMonospaceFontFace()  : void
Ensures the default "monospace" font face is set
ensureRegularFontFace()  : void
Ensures the default "regular" font face is set
ensureSemiBoldFontFace()  : void
Ensures the default "semi bold" font face is set
executeDeferredRenders()  : void
Executes all deferred render functions and clears the queue This should be called at the end of the frame
getStaticValue()  : mixed
Gets a static value (persistant data, over multiple frames)
isHovered()  : bool
Returns true if the mouse is currently hovering over the current bounds
isHoveredAABB()  : bool
Returns true if the given AABB is currently hovered by the mouse
isHoveredAt()  : bool
Returns true if the given Position and Size are currently hovered by the mouse
setStaticValue()  : void
Sets a static value (persistant data, over multiple frames)
triggeredOnce()  : bool
Returns boolean if an action + el id has been triggered once.

Properties

$contentScale

Current content scale factor

public float $contentScale = 1.0

$deferredRenderQueue

Queue of deferred render functions to be executed at the end of the frame This allows elements like dropdowns to render on top of other elements

private array<string|int, callable(FUIRenderContext): void> $deferredRenderQueue = []

$persistentData

Static data storage for persistent values across frames

private static array<string, mixed> $persistentData = []

Methods

clearAllStaticValues()

Clears all static values

public clearAllStaticValues() : void

clearStaticValue()

Clears a specific static value

public clearStaticValue(string $key) : void
Parameters
$key : string

deferRender()

Adds a render function to be executed at the end of the frame This allows elements to render on top of others (z-index control)

public deferRender(Closure $renderFunc) : void
Parameters
$renderFunc : Closure

ensureFontFace()

Ensures the given font face is set

public ensureFontFace(string $fontFace) : void
Parameters
$fontFace : string

ensureMonospaceFontFace()

Ensures the default "monospace" font face is set

public ensureMonospaceFontFace() : void

ensureRegularFontFace()

Ensures the default "regular" font face is set

public ensureRegularFontFace() : void

ensureSemiBoldFontFace()

Ensures the default "semi bold" font face is set

public ensureSemiBoldFontFace() : void

executeDeferredRenders()

Executes all deferred render functions and clears the queue This should be called at the end of the frame

public executeDeferredRenders() : void

getStaticValue()

Gets a static value (persistant data, over multiple frames)

public getStaticValue(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null

isHovered()

Returns true if the mouse is currently hovering over the current bounds

public isHovered() : bool
Return values
bool

isHoveredAABB()

Returns true if the given AABB is currently hovered by the mouse

public isHoveredAABB(float $x, float $y, float $width, float $height) : bool
Parameters
$x : float
$y : float
$width : float
$height : float
Return values
bool

isHoveredAt()

Returns true if the given Position and Size are currently hovered by the mouse

public isHoveredAt(Vec2 $pos, Vec2 $size) : bool
Parameters
$pos : Vec2
$size : Vec2
Return values
bool

setStaticValue()

Sets a static value (persistant data, over multiple frames)

public setStaticValue(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

triggeredOnce()

Returns boolean if an action + el id has been triggered once.

public triggeredOnce(string $id, bool $condition) : bool

Basically will return true only once and false if the condition is met again until reset. Reset is done by calling the function with the condition set to false.

Parameters
$id : string
$condition : bool
Return values
bool

        
On this page

Search results