VISU - PHP Game Framework

TextLabelRenderer
in package

Table of Contents

Properties

$gl  : GLState
$loadedFonts  : array<string, BitmapFontAtlas>
The loaded bitmap fonts
$loadedFontTextures  : array<string, Texture>
The loaded font textures
$renderGroups  : array<string, TextLabelRenderGroup>
An array of render groups
$shaderProgram  : ShaderProgram
The label rendering shader

Methods

__construct()  : mixed
Constructor
attachPass()  : void
Attaches a render pass to the pipeline
createLabel()  : TextLabel
Creates a label
destroyLabel()  : void
Destroys a label
loadFont()  : void
Loads a bitmap font under the given handle.
synchroniseWithEntites()  : void
Will update the internal label groups to match the current state of the entities.
unloadFont()  : void
Unloads a bitmap font under the given handle.
getDefaultFontHandle()  : string
Returns the default font handle, aka the first font that was loaded.
rebuildRenderGroup()  : void
Rebuilds the render group

Properties

Methods

createLabel()

Creates a label

public createLabel(string $text[, string|null $fontHandle = null ][, string $renderGroup = 'default' ][, Transform|null $transform = null ][, bool $isStatic = false ]) : TextLabel

A label is bacically just a piece of text with a position, font and color. Keep a good look on the "renderGroup" every label is assigned to a render group. Labels with the same render group will be rendered together in one draw call. This means when you change only one label in a group, the entire group will be re-rendered and uploaded to the GPU.

Parameters
$text : string
$fontHandle : string|null = null
$renderGroup : string = 'default'
$transform : Transform|null = null
$isStatic : bool = false
Return values
TextLabel

loadFont()

Loads a bitmap font under the given handle.

public loadFont(string $handle, BitmapFontAtlas $fontAtlas) : void

The handle acts as a simple identifier for the font.

Parameters
$handle : string
$fontAtlas : BitmapFontAtlas

unloadFont()

Unloads a bitmap font under the given handle.

public unloadFont(string $handle) : void
Parameters
$handle : string

getDefaultFontHandle()

Returns the default font handle, aka the first font that was loaded.

private getDefaultFontHandle() : string
Return values
string

        
On this page

Search results