NAP
Public Member Functions | List of all members
App Class Reference

#include </opt/build/repo/nap/cmake/app_creator/template/src/templateapp.h>

Public Member Functions

APP_NAME_INPUTCASE App (nap::Core &core)
 
bool init (utility::ErrorState &error) override
 
void update (double deltaTime) override
 
void render () override
 
void windowMessageReceived (WindowEventPtr windowEvent) override
 
void inputMessageReceived (InputEventPtr inputEvent) override
 
virtual int shutdown () override
 
 App (Core &core)
 
virtual void inputMessageReceived (InputEventPtr inputEvent)
 
virtual void windowMessageReceived (WindowEventPtr windowEvent)
 

Description

Main application that is called from within the main loop

The default NAP application. Derive from this object to receive mouse, keyboard and window events. Override inputMessageReceived to receive mouse and keyboard events. Override windowMessageReceived to receive window events. This class works in conjunction with an AppEventHandler which polls and forwards incoming system messages.

Constructor & Destructor Documentation

◆ App() [1/2]

APP_NAME_INPUTCASE App ( nap::Core core)

Constructor

Parameters
coreinstance of the NAP core system

◆ App() [2/2]

App ( Core core)

Member Function Documentation

◆ init()

bool init ( utility::ErrorState error)
override

Initialize all the services and app specific data structures

Parameters
errorcontains the error code when initialization fails
Returns
if initialization succeeded

◆ inputMessageReceived() [1/2]

virtual void inputMessageReceived ( InputEventPtr  inputEvent)
virtual

Called when the system receives an input event

Parameters
inputEventthe received input event

◆ inputMessageReceived() [2/2]

void inputMessageReceived ( InputEventPtr  inputEvent)
override

Called when the app receives an input message (from a mouse, keyboard etc.)

Parameters
inputEventthe input event that occurred

◆ render()

void render ( )
override

Render is called after update. Use this call to render objects to a specific target

◆ shutdown()

virtual int shutdown ( )
overridevirtual

Called when the app is shutting down after quit() has been invoked

Returns
the application exit code, this is returned when the main loop is exited

◆ update()

void update ( double  deltaTime)
override

Update is called every frame, before render.

Parameters
deltaTimethe time in seconds between calls

◆ windowMessageReceived() [1/2]

virtual void windowMessageReceived ( WindowEventPtr  windowEvent)
virtual

Called when the system receives a window event

Parameters
windowEventthe event that contains the window information

◆ windowMessageReceived() [2/2]

void windowMessageReceived ( WindowEventPtr  windowEvent)
override

Called when the app receives a window message.

Parameters
windowEventthe window message that occurred