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

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

Member Function Documentation

◆ onConfigure()

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.

◆ registerMetadataOverride()

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.

◆ onKeyInputEvent()

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: