Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::AppBase Class Referenceabstract

#include <AppBase.hpp>

Inheritance diagram for Diligent::AppBase:
Diligent::AndroidAppBase Diligent::EmscriptenAppBase Diligent::IOSAppBase Diligent::LinuxAppBase Diligent::MacOSAppBase Diligent::TVOSAppBase Diligent::UWPAppBase Diligent::Win32AppBase

Public Types

enum class  GoldenImageMode { None = 0 , Capture , Compare , CompareUpdate }
 Golden image capture mode. More...
 
enum class  CommandLineStatus { OK , Help , Error }
 Command line processing result. More...
 

Public Member Functions

virtual CommandLineStatus ProcessCommandLine (int argc, const char *const *argv)=0
 Processes the command line arguments.
 
virtual const char * GetAppTitle () const =0
 Returns the application tile.
 
virtual void Update (double CurrTime, double ElapsedTime)
 Updates the application state.
 
virtual void Render ()=0
 Renders the frame.
 
virtual void Present ()=0
 Presents the frame.
 
virtual void WindowResize (int width, int height)=0
 Called when the window resizes.
 
virtual void GetDesiredInitialWindowSize (int &width, int &height)
 Called by the framework to request the desired initial window size.
 
virtual GoldenImageMode GetGoldenImageMode () const
 Returns the golden image mode, see Diligent::AppBase::GoldenImageMode.
 
virtual int GetExitCode () const
 Returns the exit code.
 
virtual bool IsReady () const
 Returns true if the app is initialized and ready to run.
 
virtual HOT_KEY_FLAGS GetHotKeyFlags () const
 Returns the hot key handling flags.
 

Detailed Description

Base class for native applications. Platform-specific classes such as Win32AppBase, LinuxAppBase are inherited from AppBase.

Member Enumeration Documentation

◆ CommandLineStatus

Command line processing result.

Enumerator
OK 

Command line has been processed successfully.

Help 

Command line help has been requested.

Error 

Command line was processed with error.

◆ GoldenImageMode

Golden image capture mode.

Enumerator
None 

Gloden image processing is disabled.

Capture 

Capture the golden image. In this mode, the application renders one frame, captures it as a golden image and exits.

Compare 

Compare the golden image. In this mode, the application renders one frame, compares it with the golden image and exists. Zero exit code indicates that the frame is identical to the golden image. The non-zero code indicates the number of pixels that differ.

CompareUpdate 

Compare the golden image as in Compare mode, and then update it as in Capture mode.

Member Function Documentation

◆ GetAppTitle()

virtual const char * Diligent::AppBase::GetAppTitle ( ) const
pure virtual

Returns the application tile.

An application must override this method to define the application title.

Returns
The application title

◆ GetDesiredInitialWindowSize()

virtual void Diligent::AppBase::GetDesiredInitialWindowSize ( int & width,
int & height )
inlinevirtual

Called by the framework to request the desired initial window size.

This method is called before the platform-specific window is created. An application may override this method to specify required initial window width and height.

◆ GetExitCode()

virtual int Diligent::AppBase::GetExitCode ( ) const
inlinevirtual

Returns the exit code.

An application may override this method to return a specific exit code.

◆ Present()

virtual void Diligent::AppBase::Present ( )
pure virtual

Presents the frame.

An application must override this method to perform operations required to present the rendered frame on the screen.

◆ ProcessCommandLine()

virtual CommandLineStatus Diligent::AppBase::ProcessCommandLine ( int argc,
const char *const * argv )
pure virtual

Processes the command line arguments.

The method is called by the framework to let the application process the command line arguments. This method is called before any other method is called.

Parameters
[in]argc- The number of arguments in argv array.
[in]argv- An array of arguments.
Returns
Command line processing status, see CommandLineStatus.

◆ Render()

virtual void Diligent::AppBase::Render ( )
pure virtual

Renders the frame.

An application must override this method to perform operations required to render the frame.

◆ Update()

virtual void Diligent::AppBase::Update ( double CurrTime,
double ElapsedTime )
inlinevirtual

Updates the application state.

This method is called by the framework to let the application perform the required update operations.

Parameters
[in]CurrTime- Current time, i.e. the time elapsed since the application started.
[in]ElapsedTime- The time elapsed since the previous frame update.

Reimplemented in Diligent::EmscriptenAppBase, Diligent::IOSAppBase, Diligent::MacOSAppBase, Diligent::TVOSAppBase, and Diligent::UWPAppBase.

◆ WindowResize()

virtual void Diligent::AppBase::WindowResize ( int width,
int height )
pure virtual

Called when the window resizes.

An application must override this method to perform operations required to resize the window.

Parameters
[in]width- New window width
[in]height- New window height