Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::ExampleApplication Class Reference

#include <kanzi/example_application.hpp>

Inheritance diagram for kanzi::ExampleApplication:
[legend]

Public Member Functions

void onConfigure (ApplicationProperties &configuration) override
 Callback for configuring the application properties. More...
 
void onKeyInputEvent (const KeyEvent &keyEvent) override
 Callback for handling input events from keyboard. More...
 
void registerMetadataOverride (ObjectFactory &) override
 Registers the rest of the module metadata, such as loaders for types in the module. More...
 
- Public Member Functions inherited from kanzi::Application
 Application ()
 Constructs the application object. More...
 
Vector2 getRenderingAreaOffset () const
 Returns the translation that Kanzi uses as the arrange transformation of the default Screen node. More...
 
TextureSharedPtr getRootCompositionTarget () const
 Returns the root composition target of the application. More...
 
StartupProfilerRegistrygetStartupProfilerRegistry () const
 Gets the startup profiler registry. More...
 
void initialize (const SystemProperties &systemProperties)
 Initializes the application to a consistent state. More...
 
void initializeGL ()
 Initializes the graphics language subsystem. More...
 
bool loadKzbFile (string_view fileName, bool setStartupPrefab)
 Loads a kzb file or multiple kzb files listed in a configuration file. More...
 
void main (const SystemProperties &systemProperties)
 Application entry point. More...
 
void resumeGL ()
 Resumes the graphics language subsystem. More...
 
void setRenderingAreaOffset (Vector2 offset)
 Sets the translation that Kanzi uses as the arrange transformation of the default Screen node. More...
 
void setRootCompositionTarget (TextureSharedPtr compositionTarget)
 Sets the root composition target of the application. More...
 
void suspendGL ()
 Suspends the graphics language subsystem. More...
 
void uninitialize ()
 Uninitializes the application. More...
 
void uninitializeGL ()
 Uninitializes the graphics language subsystem. More...
 
 ~Application () override
 Destructs the application object. More...
 
void pause ()
 Puts the application from the Running state to the Paused state. More...
 
void resume ()
 Resumes the application from the Paused state to the Running state. More...
 
void quit ()
 Quits the application. More...
 
void patchProject (uintmax_t byteCount, const byte *bytes)
 Applies a Kanzi Studio Preview patch. More...
 
DomaingetDomain () const
 Access domain. More...
 
Renderer3DgetRenderer3D () const
 Access the renderer. More...
 
Node2DSharedPtr getRoot () const
 Access the root node. More...
 
ScreenSharedPtr getScreen () const
 Access the Screen node. More...
 
void setScreen (ScreenSharedPtr screen)
 Sets, configures, and attaches the Screen node of the Application. More...
 
const MainLoopSchedulergetMainLoopScheduler () const
 Access the associated MainLoopScheduler. More...
 
MainLoopSchedulergetMainLoopScheduler ()
 Access the associated MainLoopScheduler. More...
 
ResourceManagergetResourceManager () const
 Access resource manager. More...
 
KZ_DEPRECATED InputManagergetInputManager () const
 Access input manager. More...
 
detail::MessageDispatcher * getMessageDispatcher () const
 Access message dispatcher. More...
 
float getFramesPerSecond () const
 Gets the frame rate of the application. More...
 
size_t getGraphicsOutputCount () const
 Access graphics output count. More...
 
GraphicsOutputSharedPtr getGraphicsOutput (size_t index=0) const
 Access graphics outputs. More...
 
template<typename Interface >
shared_ptr< Interface > getGraphicsOutput (size_t index) const
 Query graphics output interfaces. More...
 
void appendGraphicsOutput (GraphicsOutputSharedPtr graphicsOutput)
 Attach graphics output. More...
 
void removeGraphicsOutput (size_t index=0)
 Remove graphics output. 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 to domain and register its event handle with main loop scheduler. More...
 
void removeEventSource (size_t index=0)
 Remove event source. More...
 
MainLoopState getState () const
 Access application state. More...
 
ApplicationProperties getApplicationProperties () const
 Access application properties. More...
 
ApplicationProperties::PerformanceInfoLevel getPerformanceInfoLevel () const
 Gets the Performance HUD information level. More...
 
void setPerformanceInfoLevel (ApplicationProperties::PerformanceInfoLevel level)
 Sets the Performance HUD information level. More...
 
void loadFontEngine (ApplicationProperties::FontEngine fontEngine)
 Loads the font engine for the font manager. More...
 
void setAllowIndefiniteSleep (bool enabled)
 Sets or resets the flag that allows indefinite sleep. More...
 
void setDeploymentQueueTimeBudget (chrono::nanoseconds budget)
 Sets the time budget used to deploy asynchronously loaded Resources per frame. More...
 
- Public Member Functions inherited from kanzi::Module
virtual void destroy ()
 
virtual MetaclassContainer getMetaclassesOverride ()
 
 Module ()
 
virtual void registerDebugRenderingFunctions (DebugRenderRegistry &)
 Registers the debug rendering functions of the module. More...
 
void setDomain (Domain *domain)
 Sets the domain. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::Module
typedef vector< const Metaclass * > MetaclassContainer
 
typedef MetaclassContainer::iterator MetaclassIterator
 
- Protected Member Functions inherited from kanzi::Application
virtual void initializeProperties (const SystemProperties &systemProperties)
 Loads the application properties, based on configuration file and command-line arguments. More...
 
virtual void initializeSystem ()
 Initializes profiling, event sources, and graphics output. More...
 
virtual void initializePlatform ()
 Initializes platform configuration. More...
 
virtual void uninitializePlatform ()
 Unitializes platform configuration. More...
 
virtual void initializeDomain ()
 Initializes Kanzi Domain and loads a kzb file. More...
 
virtual void initializeMainLoopTasks ()
 Attaches the default tasks to the main loop scheduler. More...
 
void applyMainLoopConfigs ()
 Applies the frame limit and idle-suspension configurations from the application properties to the main loop scheduler, and attaches event handles and preconditions. More...
 
void setFontBackendProperties ()
 Applies the font backend properties from the application properties to the FontManager. More...
 
void clearEventQueue ()
 Clears the event queue. More...
 
void gatherEvents ()
 Gathers all input events from the event sources into the event queue. More...
 
void handleApplicationEvents ()
 Executes the application-defined event handler on all events in the event queue. More...
 
virtual void handleEvents (EventQueue &eventQueue)
 Executes the application-defined event handler on all events in the event queue. More...
 
void handleGraphicsEvents ()
 Executes the event handler of the graphics subsystem. The events to handle are from the event queue. More...
 
void handleInputManagerEvents ()
 Executes the event handler of the input subsystem. The events to handle are from the event queue. More...
 
void loadStartupKzb ()
 Instantiates and attaches the startup Screen node from the startup prefab. More...
 
void progressDeploymentQueue ()
 Processes the deployment queue for asynchronous loading tasks. More...
 
void updateRenderer (chrono::nanoseconds deltaTime)
 Advances renderer clock with time delta, and attaches active graphics output to it. More...
 
void measurePerformance (chrono::nanoseconds deltaTime)
 Updates the calculation of the Application frame rate. More...
 
void adjustRenderingArea ()
 Sets the rendering area on the graphics output based on the size, orientation, and metrics. More...
 
void layout ()
 Lays out the node tree. More...
 
void tickAnimations (chrono::nanoseconds deltaTime)
 Ticks all the active animations. More...
 
virtual void render ()
 Renders the node tree. More...
 
void renderPerformanceInfo ()
 Renders the Performance HUD. More...
 
void clearAllRenderBuffers (ColorRGBA clearColor)
 Clears all render buffers. More...
 
void present ()
 Updates the graphics output buffer with the rendered node tree. More...
 
virtual void onStartup ()
 Callback for the startup logic. More...
 
virtual void onShutdown ()
 Callback for the shutdown logic. More...
 
virtual void onProjectLoaded ()
 Callback for initializations that use data from a kzb file. More...
 
virtual void onUpdate (chrono::nanoseconds deltaTime)
 Callback for the update logic. More...
 
virtual void onPointerInputEvent (const PointerEvent &pointerEvent)
 Callback for handling of input events from a pointing device, such as a mouse or touch screen. More...
 
virtual optional< chrono::nanoseconds > onSuspend (chrono::nanoseconds remainingFrameAllotment)
 Callback for determining the duration of suspension in a main loop frame. More...
 
virtual void onPause ()
 Kanzi calls this callback when the application main loop enters the Paused state. More...
 
virtual void onResume ()
 Kanzi calls this callback when the application main loop returns from the Paused to the Running state. More...
 
virtual void onResumeCheck ()
 Kanzi calls this callback for the event handling logic when the application main loop is in the Paused state. More...
 
virtual void mainOverride (const SystemProperties &systemProperties)
 Override function for main(). 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 progressDeploymentQueueOverride ()
 Override function for progressDeploymentQueue(). More...
 
virtual void setScreenOverride ()
 Override function for setScreen(). More...
 
void logStartupProfilingData () const
 Logs startup profiling data. More...
 
virtual bool isToolPresent () const
 Indicates whether application is running in the Kanzi Studio Preview. More...
 
void logGraphicsInformation ()
 Log graphics information based on application properties. More...
 
KZ_DEPRECATED KzuEnginegetEngine () const
 Access Kanzi Engine. More...
 
PerformanceInfoacquirePerformanceInfo ()
 Acquire performance information object. More...
 
void restoreNodeResources (Screen &screen)
 Restores node resources after application sleep by calling Node::restoreResources() recursively for the nodes in the tree. More...
 
- Protected Member Functions inherited from kanzi::Module
virtual ~Module ()=default
 Destructor. More...
 
- Protected Attributes inherited from kanzi::Application
ApplicationProperties m_applicationProperties
 Application properties. More...
 
KzuEnginem_engine
 Kanzi Engine instance. More...
 
MainLoopTaskToken m_loadStartupKzbToken
 The token of LoadStartyKzb Main Loop Scheduler task. More...
 
MainLoopScheduler m_mainLoopScheduler
 Main loop scheduler. More...
 
unique_ptr< PerformanceInfom_performanceInfo
 Performance HUD information. More...
 
bool m_projectLoaded
 Flag to be set when project has been loaded. More...
 
string m_startupPrefabUrl
 URL of the startup prefab. More...
 
SystemProperties m_systemProperties
 Container of command line parameters of the program. More...
 
- Protected Attributes inherited from kanzi::Module
Domainm_domain
 The domain this module is registered to. More...
 

Member Function Documentation

void kanzi::ExampleApplication::onConfigure ( ApplicationProperties configuration)
inlineoverridevirtual

Callback for configuring the application properties.

Kanzi calls this callback before it reads the application.cfg and before it initializes the graphics subsystem.

Parameters
configurationAllows modification of the application properties.
See also
ApplicationProperties, NativeWindowProperties, KzsSurfaceProperties, EventSourceProperties, PerformanceInfoProperties, ApplicationProperties::FontEngine

Reimplemented from kanzi::Application.

void kanzi::ExampleApplication::registerMetadataOverride ( ObjectFactory )
inlineoverridevirtual

Registers the rest of the module metadata, such as loaders for types in the module.

When registering a module, a domain calls this function.

Reimplemented from kanzi::Module.

void kanzi::ExampleApplication::onKeyInputEvent ( const KeyEvent keyEvent)
inlineoverridevirtual

Callback for handling input events from keyboard.

Kanzi calls this function inside the Input stage of the main loop.

Parameters
keyEventReference to the event.

Reimplemented from kanzi::Application.


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