Application class. More...
#include <kanzi/application/application.hpp>
Public Types | |
enum | State { Uninitialized, Running, Suspended, Quitting, Error } |
Enumeration for different application states. More... | |
![]() | |
typedef vector< const Metaclass * > | MetaclassContainer |
typedef MetaclassContainer::iterator | MetaclassIterator |
Public Member Functions | |
Application () | |
Constructs the application object. More... | |
virtual | ~Application () |
Destructs the application object. More... | |
void | initialize (const SystemProperties &systemProperties) |
Initializes the application to a consistent state. More... | |
void | uninitialize () |
Uninitializes the application. More... | |
void | initializeGL () |
Initializes the graphics language subsystem. More... | |
void | uninitializeGL () |
Uninitializes the graphics language subsystem. More... | |
void | suspendGL () |
Suspends the graphics language subsystem. More... | |
void | resumeGL () |
Resumes the graphics language subsystem. More... | |
Domain * | getDomain () const |
Access domain. More... | |
Renderer3D * | getRenderer () const |
Access the renderer. More... | |
Node2DSharedPtr | getRoot () const |
Access root node. More... | |
ScreenSharedPtr | getScreen () const |
Access screen. More... | |
void | setScreen (ScreenSharedPtr screen) |
Set screen. More... | |
KzuTaskScheduler * | getTaskScheduler () const |
Access engine task scheduler. More... | |
ResourceManager * | getResourceManager () const |
Access resource manager. More... | |
KzuInputManager * | getInputManager () const |
Access input manager. More... | |
KzuBinaryLoader * | getBinaryLoader () const |
Access binary loader. More... | |
KzuPreviewSystem * | getPreviewSystem () const |
Access preview system. More... | |
LayerRenderpass * | getNode2DRenderpass () const |
Access layer composer. More... | |
KzuMessageDispatcher * | getMessageDispatcher () const |
Access message dispatcher. More... | |
TransformedScene2D * | getNode2DTransformedScene () const |
Access layer transformed scene. More... | |
kzFloat | getFramesPerSecond () const |
Access FPS info. More... | |
void | enablePreviewSystem () |
Initializes the subsystem for preview features. More... | |
size_t | getRenderTargetCount () const |
Access render target count. More... | |
RenderTargetSharedPtr | getRenderTarget (size_t index=0) const |
Access render targets. More... | |
void | appendRenderTarget (RenderTargetSharedPtr renderTarget) |
Attach render target. More... | |
void | removeRenderTarget (size_t index=0) |
Remove render target. More... | |
size_t | getEventSourceCount () const |
Access event source count. More... | |
EventSourceSharedPtr | getEventSource (size_t index=0) const |
Access event sources. More... | |
void | appendEventSource (EventSourceSharedPtr eventSource) |
Attach event source. More... | |
void | removeEventSource (size_t index=0) |
Remove event source. More... | |
State | getState () |
Access application state. More... | |
ApplicationProperties | getApplicationProperties () const |
Access application properties. More... | |
void | main (const SystemProperties &systemProperties) |
Application entry point. More... | |
void | update (chrono::milliseconds deltaTime) |
Updates application logic. More... | |
void | render () |
Renders the root layer. More... | |
void | progressDeploymentQueue () |
Processes the deployment queue for asynchronous loading tasks. More... | |
void | suspend () |
Suspends the application as soon as possible. More... | |
void | resume () |
Resumes the application as soon as possible. More... | |
void | quit () |
Quits the application as soon as possible. More... | |
![]() | |
Module () | |
virtual MetaclassContainer | getMetaclassesOverride () |
virtual void | destroy () |
virtual void | registerMetadataOverride (ObjectFactory &) |
Protected Member Functions | |
virtual void | onStartup () |
Function callback for application start. More... | |
virtual void | onShutdown () |
Function callback for application end. More... | |
virtual void | onProjectLoaded () |
Function callback for initialization that is using the .KZB data. This function is called right after the .KZB binaries have been loaded. More... | |
virtual void | onConfigure (ApplicationProperties &configuration) |
User-defined configuration. More... | |
virtual void | onUpdate (chrono::milliseconds deltaTime) |
Function callback for updating logic. More... | |
virtual void | onPreRender () |
Function callback for rendering. This function is called for every frame before any other rendering function. More... | |
virtual void | onPostRender () |
Function callback for rendering. This function is called for every frame after the root layer has been rendered. More... | |
virtual void | onPointerInputEvent (const KzsInputEventPointer *inputData) |
Event callback for pointing device (e.g. mouse or touch screen) input events. More... | |
virtual void | onKeyInputEvent (const KzsInputEventKey *inputData) |
Event callback for keyboard input events. More... | |
virtual void | onIdle () |
Event callback for idle loop. More... | |
virtual void | onSuspend () |
Event callback for application suspension. More... | |
virtual void | onResume () |
Event callback for application resume. More... | |
virtual void | initializeOverride (const SystemProperties &systemProperties) |
Override function for initialize(). More... | |
virtual void | uninitializeOverride () |
Override function for uninitialize(). More... | |
virtual void | initializeGLOverride () |
Override function for initializeGL(). More... | |
virtual void | uninitializeGLOverride () |
Override function for uninitializeGL(). More... | |
virtual void | suspendGLOverride () |
Override function for suspendGL(). More... | |
virtual void | resumeGLOverride () |
Override function for resumeGL(). More... | |
virtual void | mainOverride (const SystemProperties &systemProperties) |
Override function for main(). More... | |
virtual void | updateOverride (chrono::milliseconds deltaTime) |
Override function for update(). More... | |
virtual void | renderOverride () |
Override function for render(). More... | |
virtual void | progressDeploymentQueueOverride () |
Override function for progressDeploymentQueue(). More... | |
virtual void | initializeProperties (const SystemProperties &systemProperties) |
virtual void | initializeProfiling () |
virtual void | initializeEngine () |
virtual void | initializeSystem () |
void | projectLoaded () |
virtual void | handleEvents (const KzsEventQueue *eventQueue) |
virtual bool | isToolPresent () const |
virtual void | run () |
void | idle () |
void | idleLoop () |
void | loadPlugins () |
KzuEngine * | getEngine () const |
Acces engine. More... | |
![]() | |
virtual | ~Module () |
Protected Attributes | |
vector< EventSourceSharedPtr > | m_eventSources |
Container for event sources. More... | |
vector< RenderTargetSharedPtr > | m_renderTargets |
Container for render targets. More... | |
State | m_state |
Current state of the application. More... | |
SystemProperties | m_systemProperties |
System properties. More... | |
ApplicationProperties | m_applicationProperties |
Application properties. More... | |
KzcMemoryManager * | m_systemMemoryManager |
System memory manager. More... | |
KzsEventQueue * | m_eventQueue |
The event queue for user input and window events. More... | |
KzsEventQueue * | m_eventQueueBuffer |
Temporary event queue used for combining similar events. More... | |
KzuEngine * | m_engine |
Engine instance. More... | |
shared_ptr< Scheduler > | m_scheduler |
Execution scheduler. More... | |
Friends | |
class | PreviewApplication |
Application class.
Base class for application logic.
Enumeration for different application states.
kanzi::Application::Application | ( | ) |
Constructs the application object.
|
virtual |
Destructs the application object.
void kanzi::Application::initialize | ( | const SystemProperties & | systemProperties | ) |
Initializes the application to a consistent state.
This is the first function called by the application framework after constructing the application. This function tries to read the file application.cfg and shouldn't be called before the file system of the operating system has been initialized.
The default behavior can be changed by overriding initializeOverride().
systemProperties | Command line parameters of the program. |
void kanzi::Application::uninitialize | ( | ) |
Uninitializes the application.
This is the last function called by the application framework before destruction.
The default behavior can be changed by overriding uninitializeOverride().
void kanzi::Application::initializeGL | ( | ) |
Initializes the graphics language subsystem.
This function is called by the application framework before entering the program main loop, but after a GL context has been activated. It initializes OpenGL-related subsystems.
The default behavior can be changed by overriding initializeGLOverride().
void kanzi::Application::uninitializeGL | ( | ) |
Uninitializes the graphics language subsystem.
This function is called by the application framework after exiting the program main loop, but before a GL context has been deactivated. It undeploys all GPU resources.
The default behavior can be changed by overriding uninitializeGLOverride().
void kanzi::Application::suspendGL | ( | ) |
Suspends the graphics language subsystem.
This function is called by the application framework during application suspension, on systems where the graphics language resources are not guaranteed to be retained until the application resumes. It undeploys all GPU resources and reschedules them for redeployment.
The default behavior can be changed by overriding suspendGLOverride().
void kanzi::Application::resumeGL | ( | ) |
Resumes the graphics language subsystem.
This function is called by the application framework during application resume, if suspendGL() was called during suspension. It deploys GPU resources that were undeployed during suspendGL().
The default behavior can be changed by overriding resumeGLOverride().
Domain* kanzi::Application::getDomain | ( | ) | const |
Access domain.
Renderer3D* kanzi::Application::getRenderer | ( | ) | const |
Access the renderer.
Node2DSharedPtr kanzi::Application::getRoot | ( | ) | const |
Access root node.
ScreenSharedPtr kanzi::Application::getScreen | ( | ) | const |
Access screen.
void kanzi::Application::setScreen | ( | ScreenSharedPtr | screen | ) |
Set screen.
KzuTaskScheduler* kanzi::Application::getTaskScheduler | ( | ) | const |
Access engine task scheduler.
ResourceManager* kanzi::Application::getResourceManager | ( | ) | const |
Access resource manager.
KzuInputManager* kanzi::Application::getInputManager | ( | ) | const |
Access input manager.
KzuBinaryLoader* kanzi::Application::getBinaryLoader | ( | ) | const |
Access binary loader.
KzuPreviewSystem* kanzi::Application::getPreviewSystem | ( | ) | const |
Access preview system.
LayerRenderpass* kanzi::Application::getNode2DRenderpass | ( | ) | const |
Access layer composer.
KzuMessageDispatcher* kanzi::Application::getMessageDispatcher | ( | ) | const |
Access message dispatcher.
TransformedScene2D* kanzi::Application::getNode2DTransformedScene | ( | ) | const |
Access layer transformed scene.
kzFloat kanzi::Application::getFramesPerSecond | ( | ) | const |
Access FPS info.
void kanzi::Application::enablePreviewSystem | ( | ) |
Initializes the subsystem for preview features.
size_t kanzi::Application::getRenderTargetCount | ( | ) | const |
Access render target count.
RenderTargetSharedPtr kanzi::Application::getRenderTarget | ( | size_t | index = 0 | ) | const |
Access render targets.
index | Index of the render target to access. |
void kanzi::Application::appendRenderTarget | ( | RenderTargetSharedPtr | renderTarget | ) |
Attach render target.
renderTarget | Shared pointer to the render target to attach. |
void kanzi::Application::removeRenderTarget | ( | size_t | index = 0 | ) |
Remove render target.
index | Index of the render target to remove. |
size_t kanzi::Application::getEventSourceCount | ( | ) | const |
Access event source count.
EventSourceSharedPtr kanzi::Application::getEventSource | ( | size_t | index = 0 | ) | const |
Access event sources.
index | Index of the event source to access. |
void kanzi::Application::appendEventSource | ( | EventSourceSharedPtr | eventSource | ) |
Attach event source.
eventSource | Shared pointer to the event source to attach. |
void kanzi::Application::removeEventSource | ( | size_t | index = 0 | ) |
Remove event source.
index | Index of the event source to remove. |
State kanzi::Application::getState | ( | ) |
Access application state.
ApplicationProperties kanzi::Application::getApplicationProperties | ( | ) | const |
Access application properties.
void kanzi::Application::main | ( | const SystemProperties & | systemProperties | ) |
Application entry point.
This high-level function implements the default initialization and main loop. It is called by the application framework, except on callbacks-only systems.
The default behavior can be changed by overriding mainOverride().
systemProperties | Command line parameters of the program. |
void kanzi::Application::update | ( | chrono::milliseconds | deltaTime | ) |
Updates application logic.
This function is called once per frame during normal operation. It refreshes the application state and prepares the scene for rendering.
The default behavior can be changed by overriding updateOverride().
deltaTime | The time elapsed since the previous call to update(). |
void kanzi::Application::render | ( | ) |
Renders the root layer.
This function is called after update once per frame during normal operation. It renders the current scene.
The default behavior can be changed by overriding renderOverride().
void kanzi::Application::progressDeploymentQueue | ( | ) |
Processes the deployment queue for asynchronous loading tasks.
This function processes a single item from the deployment queue of background loading tasks every frame.
You can change the default behavior of the function by overriding the progressDeploymentQueueOverride() function.
void kanzi::Application::suspend | ( | ) |
Suspends the application as soon as possible.
void kanzi::Application::resume | ( | ) |
Resumes the application as soon as possible.
void kanzi::Application::quit | ( | ) |
Quits the application as soon as possible.
|
protectedvirtual |
Function callback for application start.
|
protectedvirtual |
Function callback for application end.
|
protectedvirtual |
Function callback for initialization that is using the .KZB data. This function is called right after the .KZB binaries have been loaded.
|
protectedvirtual |
User-defined configuration.
This callback is called after application.cfg is read, but before the graphics language subsystem is initialized.
configuration | Allows modification of the application properties. |
Reimplemented in kanzi::ExampleApplication.
|
protectedvirtual |
Function callback for updating logic.
This function is called for every frame.
deltaTime | The delta time passed to update(). By default this is the time elapsed since the previous frame in milliseconds. |
|
protectedvirtual |
Function callback for rendering. This function is called for every frame before any other rendering function.
|
protectedvirtual |
Function callback for rendering. This function is called for every frame after the root layer has been rendered.
|
protectedvirtual |
Event callback for pointing device (e.g. mouse or touch screen) input events.
|
protectedvirtual |
Event callback for keyboard input events.
Reimplemented in kanzi::ExampleApplication.
|
protectedvirtual |
Event callback for idle loop.
|
protectedvirtual |
Event callback for application suspension.
|
protectedvirtual |
Event callback for application resume.
|
protectedvirtual |
Override function for initialize().
|
protectedvirtual |
Override function for uninitialize().
|
protectedvirtual |
Override function for initializeGL().
|
protectedvirtual |
Override function for uninitializeGL().
|
protectedvirtual |
Override function for suspendGL().
|
protectedvirtual |
Override function for resumeGL().
|
protectedvirtual |
Override function for main().
|
protectedvirtual |
Override function for update().
|
protectedvirtual |
Override function for render().
|
protectedvirtual |
Override function for progressDeploymentQueue().
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protected |
|
protectedvirtual |
|
inlineprotectedvirtual |
|
protectedvirtual |
|
protected |
|
protected |
|
protected |
|
protected |
Acces engine.
|
friend |
|
protected |
Container for event sources.
|
protected |
Container for render targets.
|
protected |
Current state of the application.
|
protected |
System properties.
|
protected |
Application properties.
|
protected |
System memory manager.
|
protected |
The event queue for user input and window events.
|
protected |
Temporary event queue used for combining similar events.
|
protected |
Engine instance.
|
protected |
Execution scheduler.