Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Ndk::Application Class Reference

NDK class that represents the application, it offers a set of tools to ease the development. More...

Public Member Functions

 Application ()
 Constructs an Application object without passing command-line arguments. More...
 
 Application (int argc, char *argv[])
 Constructs an Application object with command-line arguments. More...
 
 Application (const Application &)=delete
 
 Application (Application &&)=delete
 
 ~Application ()
 Destructs the application object. More...
 
template<typename T , typename... Args>
T & AddWindow (Args &&... args)
 Adds a window to the application. More...
 
template<typename... Args>
WorldAddWorld (Args &&... args)
 Adds a world to the application. More...
 
void EnableConsole (bool enable)
 Enable/disable debug console. More...
 
void EnableFPSCounter (bool enable)
 Enable/disable debug FPS counter. More...
 
ConsoleOverlay & GetConsoleOverlay (std::size_t windowIndex=0U)
 Gets the console overlay for a specific window. More...
 
FPSCounterOverlay & GetFPSCounterOverlay (std::size_t windowIndex=0U)
 Gets the console overlay for a specific window. More...
 
const std::set< Nz::String > & GetOptions () const
 Gets the options used to start the application. More...
 
const std::map< Nz::String, Nz::String > & GetParameters () const
 Gets the parameters used to start the application. More...
 
float GetUpdateTime () const
 Gets the update time of the application. More...
 
bool HasOption (const Nz::String &option) const
 Query for a command-line option. More...
 
bool HasParameter (const Nz::String &key, Nz::String *value) const
 Query for a command-line option. More...
 
bool IsConsoleEnabled () const
 Checks if the console overlay is enabled. More...
 
bool IsFPSCounterEnabled () const
 Checks if the FPS counter overlay is enabled. More...
 
bool Run ()
 Runs the application by updating worlds, taking care about windows, ...
 
void MakeExitOnLastWindowClosed (bool exitOnClosedWindows)
 Makes the application exit when there's no more open window. More...
 
void Quit ()
 Quits the application.
 
Applicationoperator= (const Application &)=delete
 
Applicationoperator= (Application &&)=delete
 

Static Public Member Functions

static ApplicationInstance ()
 Gets the singleton instance of the application. More...
 

Detailed Description

NDK class that represents the application, it offers a set of tools to ease the development.

Constructor & Destructor Documentation

◆ Application() [1/2]

Ndk::Application::Application ( )
inline

Constructs an Application object without passing command-line arguments.

This calls Sdk::Initialize()

Remarks
Only one Application instance can exist at a time

◆ Application() [2/2]

Ndk::Application::Application ( int  argc,
char *  argv[] 
)

Constructs an Application object with command-line arguments.

Pass the argc and argv arguments from the main function.

Command-line arguments can be retrieved by application methods

This calls Sdk::Initialize()

Remarks
Only one Application instance can exist at a time

◆ ~Application()

Ndk::Application::~Application ( )
inline

Destructs the application object.

This destroy all worlds and windows and then calls Sdk::Uninitialize

Member Function Documentation

◆ AddWindow()

template<typename T , typename... Args>
T & Ndk::Application::AddWindow ( Args &&...  args)

Adds a window to the application.

Returns
A reference to the newly created windows
Parameters
argsArguments used to create the window

◆ AddWorld()

template<typename... Args>
World & Ndk::Application::AddWorld ( Args &&...  args)

Adds a world to the application.

Returns
A reference to the newly created world
Parameters
argsArguments used to create the world

◆ EnableConsole()

void Ndk::Application::EnableConsole ( bool  enable)
inline

Enable/disable debug console.

Parameters
enableShould the console overlay be enabled

◆ EnableFPSCounter()

void Ndk::Application::EnableFPSCounter ( bool  enable)
inline

Enable/disable debug FPS counter.

Parameters
enableShould the FPS counter be displayed

◆ GetConsoleOverlay()

Application::ConsoleOverlay & Ndk::Application::GetConsoleOverlay ( std::size_t  windowIndex = 0U)
inline

Gets the console overlay for a specific window.

Parameters
windowIndexIndex of the window to get
Remarks
The console overlay must be enabled
Returns
A reference to the console overlay of the window
See also
IsConsoleOverlayEnabled

◆ GetFPSCounterOverlay()

Application::FPSCounterOverlay & Ndk::Application::GetFPSCounterOverlay ( std::size_t  windowIndex = 0U)
inline

Gets the console overlay for a specific window.

Parameters
windowIndexIndex of the window to get
Remarks
The console overlay must be enabled
Returns
A reference to the console overlay of the window
See also
IsFPSCounterEnabled

◆ GetOptions()

const std::set< Nz::String > & Ndk::Application::GetOptions ( ) const
inline

Gets the options used to start the application.

Options are defined as "-optionName" in command-line and are always lower-case

Returns
Command-line options

◆ GetParameters()

const std::map< Nz::String, Nz::String > & Ndk::Application::GetParameters ( ) const
inline

Gets the parameters used to start the application.

Parameters are defined as "-key=value" in command-line, their key is lower-case but value capitals are kept.

Returns
Command-line parameters

◆ GetUpdateTime()

float Ndk::Application::GetUpdateTime ( ) const
inline

Gets the update time of the application.

Returns
Update rate

◆ HasOption()

bool Ndk::Application::HasOption ( const Nz::String option) const
inline

Query for a command-line option.

Parameters
optionOption name
Remarks
option must be lower-case
Returns
True if option is present
See also
GetOptions

◆ HasParameter()

bool Ndk::Application::HasParameter ( const Nz::String key,
Nz::String value 
) const
inline

Query for a command-line option.

Parameters
keyParameter name
valueOptional string to receive the parameter value
Remarks
key must be lower-case
Returns
True if parameter is present
See also
GetParameters

◆ Instance()

Application * Ndk::Application::Instance ( )
inlinestatic

Gets the singleton instance of the application.

Returns
Singleton application

◆ IsConsoleEnabled()

bool Ndk::Application::IsConsoleEnabled ( ) const
inline

Checks if the console overlay is enabled.

Remarks
This has nothing to do with the visibility state of the console
Returns
True if the console overlay is enabled
See also
GetConsoleOverlay

◆ IsFPSCounterEnabled()

bool Ndk::Application::IsFPSCounterEnabled ( ) const
inline

Checks if the FPS counter overlay is enabled.

Returns
True if the FPS counter overlay is enabled
See also
GetFPSCounterOverlay

◆ MakeExitOnLastWindowClosed()

void Ndk::Application::MakeExitOnLastWindowClosed ( bool  exitOnClosedWindows)
inline

Makes the application exit when there's no more open window.

Parameters
exitOnClosedWindowsShould exit be called when no more window is open

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