All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kanzi::Application Class Reference

Application class. More...

#include <kanzi/application/application.hpp>

Inheritance diagram for kanzi::Application:
kanzi::Module kanzi::ExampleApplication

Public Types

enum  State {
  Uninitialized, Running, Suspended, Quitting,
  Error
}
 Enumeration for different application states. More...
 
- Public Types inherited from kanzi::Module
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...
 
DomaingetDomain () const
 Access domain. More...
 
Renderer3DgetRenderer () 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...
 
KzuTaskSchedulergetTaskScheduler () const
 Access engine task scheduler. More...
 
ResourceManagergetResourceManager () const
 Access resource manager. More...
 
KzuInputManagergetInputManager () const
 Access input manager. More...
 
KzuBinaryLoadergetBinaryLoader () const
 Access binary loader. More...
 
KzuPreviewSystemgetPreviewSystem () const
 Access preview system. More...
 
LayerRenderpassgetNode2DRenderpass () const
 Access layer composer. More...
 
KzuMessageDispatchergetMessageDispatcher () const
 Access message dispatcher. More...
 
TransformedScene2DgetNode2DTransformedScene () 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...
 
- Public Member Functions inherited from kanzi::Module
 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 ()
 
KzuEnginegetEngine () const
 Acces engine. More...
 
- Protected Member Functions inherited from kanzi::Module
virtual ~Module ()
 

Protected Attributes

vector< EventSourceSharedPtrm_eventSources
 Container for event sources. More...
 
vector< RenderTargetSharedPtrm_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...
 
KzcMemoryManagerm_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...
 
KzuEnginem_engine
 Engine instance. More...
 
shared_ptr< Schedulerm_scheduler
 Execution scheduler. More...
 

Friends

class PreviewApplication
 

Detailed Description

Application class.

Base class for application logic.

Member Enumeration Documentation

Enumeration for different application states.

Enumerator
Uninitialized 

The application is not yet initialized.

Running 

The application is running normally.

Suspended 

The application is suspended. The OpenGL graphics context is destroyed.

Quitting 

The application is in the process of quitting without errors.

Error 

The application has encountered an error and exits immediately.

Constructor & Destructor Documentation

kanzi::Application::Application ( )

Constructs the application object.

virtual kanzi::Application::~Application ( )
virtual

Destructs the application object.

Member Function Documentation

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().

Parameters
systemPropertiesCommand 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.

Returns
Pointer to domain.
Renderer3D* kanzi::Application::getRenderer ( ) const

Access the renderer.

Returns
Renderer3D pointer.
Node2DSharedPtr kanzi::Application::getRoot ( ) const

Access root node.

Returns
Node shared pointer.
ScreenSharedPtr kanzi::Application::getScreen ( ) const

Access screen.

Returns
Screen shared pointer.
void kanzi::Application::setScreen ( ScreenSharedPtr  screen)

Set screen.

KzuTaskScheduler* kanzi::Application::getTaskScheduler ( ) const

Access engine task scheduler.

Returns
Engine task scheduler pointer.
ResourceManager* kanzi::Application::getResourceManager ( ) const

Access resource manager.

Returns
Resource manager pointer.
KzuInputManager* kanzi::Application::getInputManager ( ) const

Access input manager.

Returns
Input manager pointer.
KzuBinaryLoader* kanzi::Application::getBinaryLoader ( ) const

Access binary loader.

Returns
Binary loader pointer.
KzuPreviewSystem* kanzi::Application::getPreviewSystem ( ) const

Access preview system.

Returns
Preview system pointer.
LayerRenderpass* kanzi::Application::getNode2DRenderpass ( ) const

Access layer composer.

Returns
Layer composer pointer.
KzuMessageDispatcher* kanzi::Application::getMessageDispatcher ( ) const

Access message dispatcher.

Returns
Message dispatcher pointer.
TransformedScene2D* kanzi::Application::getNode2DTransformedScene ( ) const

Access layer transformed scene.

Returns
Layer transformed scene pointer.
kzFloat kanzi::Application::getFramesPerSecond ( ) const

Access FPS info.

Returns
Frames per second measurement.
void kanzi::Application::enablePreviewSystem ( )

Initializes the subsystem for preview features.

size_t kanzi::Application::getRenderTargetCount ( ) const

Access render target count.

Returns
Number of attached render targets.
RenderTargetSharedPtr kanzi::Application::getRenderTarget ( size_t  index = 0) const

Access render targets.

Parameters
indexIndex of the render target to access.
Returns
Shared pointer to the specified render target.
void kanzi::Application::appendRenderTarget ( RenderTargetSharedPtr  renderTarget)

Attach render target.

Parameters
renderTargetShared pointer to the render target to attach.
void kanzi::Application::removeRenderTarget ( size_t  index = 0)

Remove render target.

Parameters
indexIndex of the render target to remove.
size_t kanzi::Application::getEventSourceCount ( ) const

Access event source count.

Returns
Number of attached event sources.
EventSourceSharedPtr kanzi::Application::getEventSource ( size_t  index = 0) const

Access event sources.

Parameters
indexIndex of the event source to access.
Returns
Shared pointer to the specified event source.
void kanzi::Application::appendEventSource ( EventSourceSharedPtr  eventSource)

Attach event source.

Parameters
eventSourceShared pointer to the event source to attach.
void kanzi::Application::removeEventSource ( size_t  index = 0)

Remove event source.

Parameters
indexIndex of the event source to remove.
State kanzi::Application::getState ( )

Access application state.

Returns
Current application state.
ApplicationProperties kanzi::Application::getApplicationProperties ( ) const

Access application properties.

Returns
Current 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().

Parameters
systemPropertiesCommand 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().

Parameters
deltaTimeThe 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.

virtual void kanzi::Application::onStartup ( )
protectedvirtual

Function callback for application start.

virtual void kanzi::Application::onShutdown ( )
protectedvirtual

Function callback for application end.

virtual void kanzi::Application::onProjectLoaded ( )
protectedvirtual

Function callback for initialization that is using the .KZB data. This function is called right after the .KZB binaries have been loaded.

virtual void kanzi::Application::onConfigure ( ApplicationProperties configuration)
protectedvirtual

User-defined configuration.

This callback is called after application.cfg is read, but before the graphics language subsystem is initialized.

Parameters
configurationAllows modification of the application properties.

Reimplemented in kanzi::ExampleApplication.

virtual void kanzi::Application::onUpdate ( chrono::milliseconds  deltaTime)
protectedvirtual

Function callback for updating logic.

This function is called for every frame.

Parameters
deltaTimeThe delta time passed to update(). By default this is the time elapsed since the previous frame in milliseconds.
virtual void kanzi::Application::onPreRender ( )
protectedvirtual

Function callback for rendering. This function is called for every frame before any other rendering function.

virtual void kanzi::Application::onPostRender ( )
protectedvirtual

Function callback for rendering. This function is called for every frame after the root layer has been rendered.

virtual void kanzi::Application::onPointerInputEvent ( const KzsInputEventPointer *  inputData)
protectedvirtual

Event callback for pointing device (e.g. mouse or touch screen) input events.

virtual void kanzi::Application::onKeyInputEvent ( const KzsInputEventKey *  inputData)
protectedvirtual

Event callback for keyboard input events.

Reimplemented in kanzi::ExampleApplication.

virtual void kanzi::Application::onIdle ( )
protectedvirtual

Event callback for idle loop.

virtual void kanzi::Application::onSuspend ( )
protectedvirtual

Event callback for application suspension.

virtual void kanzi::Application::onResume ( )
protectedvirtual

Event callback for application resume.

virtual void kanzi::Application::initializeOverride ( const SystemProperties systemProperties)
protectedvirtual

Override function for initialize().

virtual void kanzi::Application::uninitializeOverride ( )
protectedvirtual

Override function for uninitialize().

virtual void kanzi::Application::initializeGLOverride ( )
protectedvirtual

Override function for initializeGL().

virtual void kanzi::Application::uninitializeGLOverride ( )
protectedvirtual

Override function for uninitializeGL().

virtual void kanzi::Application::suspendGLOverride ( )
protectedvirtual

Override function for suspendGL().

virtual void kanzi::Application::resumeGLOverride ( )
protectedvirtual

Override function for resumeGL().

virtual void kanzi::Application::mainOverride ( const SystemProperties systemProperties)
protectedvirtual

Override function for main().

virtual void kanzi::Application::updateOverride ( chrono::milliseconds  deltaTime)
protectedvirtual

Override function for update().

virtual void kanzi::Application::renderOverride ( )
protectedvirtual

Override function for render().

virtual void kanzi::Application::progressDeploymentQueueOverride ( )
protectedvirtual

Override function for progressDeploymentQueue().

virtual void kanzi::Application::initializeProperties ( const SystemProperties systemProperties)
protectedvirtual
virtual void kanzi::Application::initializeProfiling ( )
protectedvirtual
virtual void kanzi::Application::initializeEngine ( )
protectedvirtual
virtual void kanzi::Application::initializeSystem ( )
protectedvirtual
void kanzi::Application::projectLoaded ( )
protected
virtual void kanzi::Application::handleEvents ( const KzsEventQueue *  eventQueue)
protectedvirtual
virtual bool kanzi::Application::isToolPresent ( ) const
inlineprotectedvirtual
virtual void kanzi::Application::run ( )
protectedvirtual
void kanzi::Application::idle ( )
protected
void kanzi::Application::idleLoop ( )
protected
void kanzi::Application::loadPlugins ( )
protected
KzuEngine* kanzi::Application::getEngine ( ) const
protected

Acces engine.

Returns
Engine instance.

Friends And Related Function Documentation

friend class PreviewApplication
friend

Member Data Documentation

vector<EventSourceSharedPtr> kanzi::Application::m_eventSources
protected

Container for event sources.

vector<RenderTargetSharedPtr> kanzi::Application::m_renderTargets
protected

Container for render targets.

State kanzi::Application::m_state
protected

Current state of the application.

SystemProperties kanzi::Application::m_systemProperties
protected

System properties.

ApplicationProperties kanzi::Application::m_applicationProperties
protected

Application properties.

KzcMemoryManager* kanzi::Application::m_systemMemoryManager
protected

System memory manager.

KzsEventQueue* kanzi::Application::m_eventQueue
protected

The event queue for user input and window events.

KzsEventQueue* kanzi::Application::m_eventQueueBuffer
protected

Temporary event queue used for combining similar events.

KzuEngine* kanzi::Application::m_engine
protected

Engine instance.

shared_ptr<Scheduler> kanzi::Application::m_scheduler
protected

Execution scheduler.


The documentation for this class was generated from the following file: