VISU - PHP Game Framework

QuickstartApp
in package
implements GameLoopDelegate uses SystemRegistryTrait

Table of Contents

Interfaces

GameLoopDelegate

Properties

$container  : Container
$dispatcher  : Dispatcher
A event dispacher instance
$entities  : EntityRegistry
An entity registry instance
$frameIndex  : int
The current frame index
$gl  : GLState
GL State holder
$input  : Input
The input instance of the app
$inputContext  : InputContextMap
An input action mapper
$options  : QuickstartOptions
$renderResources  : PipelineResources
Rendering pipeline resources
$shaders  : ShaderCollection
A shader collection instance
$tickIndex  : int
The current tick index
$vg  : VGContext
VectorGraphics Context
$window  : Window
The window instance of the app
$bindedSystems  : array<string|int, SystemInterface>
Array of binded systems
$dbgOverlayRenderer  : QuickstartDebugMetricsOverlay
Quickstart Debug Metrics Overlay
$fullscreenTextureRenderer  : FullscreenTextureRenderer
Fullscreen Texture Renderer
$profiler  : ProfilerInterface|null
Optional Profiler

Methods

__construct()  : void
QuickstartApp constructor.
attachProfiler()  : void
Attaches the given profiler to the app, the profiler will be passed to the rendering pipeline.
bindSystem()  : void
Binds a system to the registry
bindSystems()  : void
Binds multiple systems to the registry
draw()  : void
Draw the scene. (You most definetly want to use this)
loadCompatGPUProfiler()  : void
Loads a GPU Compat Profiler and attaches it to the app
ready()  : void
A function that is invoked once the app is ready to run.
registerSystems()  : void
Registers all binded systems to the entity registry
render()  : void
Render the current game state This method is called once per frame.
renderSystem()  : void
Renders the given system with the given render context
setupDrawAfter()  : void
Prepare / setup additional render passes after the quickstart draw pass This is an "setup" method meaning you should not emit any draw calls here, but rather add additional render passes to the pipeline.
setupDrawBefore()  : void
Prepare / setup additional render passes before the quickstart draw pass This is an "setup" method meaning you should not emit any draw calls here, but rather add additional render passes to the pipeline.
shouldStop()  : bool
Returns boolean indicating whether the game loop should stop.
unregisterSystems()  : void
Unregisters all binded systems from the entity registry
update()  : void
Update the games state This method might be called multiple times per frame, or not at all if the frame rate is very high.
updateSystem()  : void
Updates the given system

Properties

$frameIndex

The current frame index

public int $frameIndex = 0

Methods

draw()

Draw the scene. (You most definetly want to use this)

public draw(RenderContext $context, RenderTarget $renderTarget) : void

This is called from within the Quickstart render pass where the pipeline is already prepared, a VG frame is also already started.

Parameters
$context : RenderContext
$renderTarget : RenderTarget

loadCompatGPUProfiler()

Loads a GPU Compat Profiler and attaches it to the app

public loadCompatGPUProfiler() : void

The GPU Compat Profiler uses blocking glBeginQuery / glEndQuery calls which are not optimal for performance but allows basic GPU profiling on all systems.

Just do not enable it in production builds ;)

ready()

A function that is invoked once the app is ready to run.

public ready() : void

This happens exactly just before the game loop starts.

Here you can prepare your game state, register services, callbacks etc.

render()

Render the current game state This method is called once per frame.

public render(float $deltaTime) : void

The render method should draw the current game state to the screen. You recieve a delta time value which you can use to interpolate between the current and the previous frame. This is useful for animations and other things that should be smooth with variable frame rates.

Parameters
$deltaTime : float

shouldStop()

Returns boolean indicating whether the game loop should stop.

public shouldStop() : bool

This method is called once per frame and should return true if the game loop should stop. This is useful if you want to quit the game after a certain amount of time or if the player has lost all his lives etc..

Return values
bool

update()

Update the games state This method might be called multiple times per frame, or not at all if the frame rate is very high.

public update() : void

The update method should step the game forward in time, this is the place where you would update the position of your game objects, check for collisions and so on.


        
On this page

Search results