The application is the core subsystem behind NRG it defines all the main features that your app. will be using at runtime. On top of controlling visual properties, it also allows you to set all the basic settings that your application will use including orientation, physics engine, graphics capabilities etc...
Name | Description |
state | Current playback state State of the Application. |
Declaration
|
soundconfig | Current SfxConfig used by the Application. |
Declaration
|
listener | Access the application Listener properties. |
Declaration
|
stats | Access the global AppStats (application statistics). |
Declaration
|
scene_count | Total amount of Scene currently loaded by your application. |
Declaration unsigned char scene_count
|
handler | Handler that manage the scripting functionalities of the application. |
Declaration
|
world | Reference to the physics World of your application (if any). |
Declaration
|
platform_id | Unique id identifying the platform your application is running on. |
Declaration
Value | Description |
0 | Windows |
1 | Linux |
2 | Android |
3 | iOS |
4 | MacOS X |
|
platform | The current platform name running your application (see platform_id ). |
Declaration
|
load_count | Number of Asset to load asynchronously. |
Declaration
|
unload_count | Number of Asset to unload asynchronously. |
Declaration unsigned char unload_count
|
event | The internal AppEvent associated to the App subsystem. |
Declaration - Note
- During scripting callbacks the
event variable is a local copy of this global structure.
|
Name | Description |
profile | The OpenGL/ES profile that should be used/emulated to run your application. |
Declaration
Value | Profile |
808604485 | OpenGL ES v2.0 |
808670021 | OpenGL ES v3.0 |
825447237 | OpenGL ES v3.1+ |
- Note
- A manual change of the profile will cause the editor to reload the project applying the new profile and changes.
|
startup_scene | Unique id of the Scene to load by default when the application start. |
Declaration unsigned int startup_scene
|
orientation | The required Orientation your application should use (mobile only). |
Declaration
|
extensions | Bit mask of all requires graphics extensions. |
Declaration
Name | Value | Extension |
fDepthTexture | bit.lshift(1,0) | OES_depth_texture. |
fPackedDepthStencil | bit.lshift(1,1) | OES_packed_depth_stencil |
fVertexArrayObject | bit.lshift(1,2) | OES_vertex_array_object |
fDrawBuffers | bit.lshift(1,3) | EXT_draw_buffers |
fOcclusionQueries | bit.lshift(1,4) | EXT_occlusion_query_boolean |
fAnisotropicFiltering | bit.lshift(1,5) | EXT_texture_filter_anisotropic |
fTextureNonPowerOfTwo | bit.lshift(1,6) | OES_texture_npot |
fColorBufferHalfFloat | bit.lshift(1,7) | EXT_color_buffer_half_float |
fColorBufferFloat | bit.lshift(1,8) | EXT_color_buffer_float |
fFrameBuffersRGB | bit.lshift(1,9) | ARB_framebuffer_sRGB |
fDisableLimits | bit.lshift(1,10) | Each core profile contains minimum supported size requirements (ie: texture size, viewport dimension etc...) in their specifications. NRG is internally using the same values of the active core profile you have selected; however, most vendor limits are higher than the minimum requirements. Toggling this extension will allow you to bypass the default limits and use the current vendor limits instead. |
|
play_fullscreen | Force the application to run fullscreen by default (desktop only). |
Declaration
|
Name | Description |
Start | Load and start running the application. |
Declaration - Note
- This function will internally call the
App.Play() function.
|
Play | Start or resume the application playback. |
Declaration Return Value
true if the application was not already playing; else return false .
|
Pause | Return the internal index of a Animation reference. |
Declaration Return Value
true if the application pause successfully; else return false if it was already on pause.
|
Stop | Stop the application playback. |
Declaration Return Value
false if the application already stopped; else return true .
|
Step | Put the application on pause and step one frame. |
Declaration
|
Reset | Reset the application. |
Declaration
|
Update | Manually trigger the update of a specific Scene. |
Declaration void Update( Scene *scene ) Parameters
scene : Reference to the Scene to update; is nil perform a full update.
|
Sync | Force the application to synchronize based on a specific time step. |
Declaration void Sync( const float time_step ) Parameters
time_step : The delta time value to synchronize the application with.
|
LoadScene | Load a Scene using its name. |
Declaration bool LoadScene( const char *name, bool async ) Parameters
name : Name of the Scene Asset to load.
async : Determine wether or not the Scene should be loaded progressively or if it need to stall the application.
|
LoadSceneAdditive | Additively load an existing Scene Asset. Using this function will force all Object contained in the Scene to be appended to the base Scene provided. |
Declaration bool LoadSceneAdditive( const char *name, Scene *base, bool async ) Parameters
name : Name of the Scene Asset to load.
base : Specify the base Scene to append the Object to.
async : Determine wether or not the Scene should be loaded progressively or if it need to stall the application.
|
GetScene | Retrieve an active Scene loaded by name. |
Declaration Scene *GetScene( const char *name ) Parameters
name : Name of the Scene to retrieve.
Return Value
nil if the name does not match any Scene currently loaded; else return the Scene reference.
|
GetSceneAt | Retrieve a loaded Scene by index. |
Declaration Scene *GetSceneAt( unsigned char index ) Parameters
index : Index of the Scene reference to retrieve.
Return Value
nil if the index is invalid; else return the Scene reference.
|
GetSceneIndex | Retrieve the rendering index of a loaded Scene. |
Declaration int GetSceneIndex( const char *name ) Parameters
name : Name of the Scene to retrieve.
Return Value
-1 if the name provided does not correspond to any Scene currently loaded; else return the Scene rendering index.
|
SetSceneIndex | Change the rendering index of a specific Scene currently loaded. |
Declaration bool SetSceneIndex( const char *name, unsigned char index ) Parameters
name : Name of the Scene to change the index.
index : The new rendering index of the Scene.
Return Value
true if the switch was successfull; false if either the name does not correspond to any Scene loaded or if the index provided is out of bounds.
|
UnloadScene | Unload a loaded Scene by name. |
Declaration bool UnloadScene( const char *name ) Parameters
name : Name of the Scene to be unloaded.
Return Value
false if the Scene does not currently loaded; else return true .
|
UnloadAll | Unload all Scene. |
Declaration
|
AddPhysics | Create a new physics World for realtime simulation. |
Declaration World *AddPhysics( void ) Return Value
Reference to the active World of your application.
|
RemovePhysics | Remove physics from your application and destroy the World (if any). |
Declaration void RemovePhysics( void )
|
LoadAssetAsync | Add an Asset to be loaded asynchronously. |
Declaration void LoadAsync( Asset *asset ) Parameters
asset : Reference to the Asset to load asynchronously.
|
UnloadAssetAsync | Unload an Asset asynchronously. |
Declaration void UnloadAssetAsync( Asset *asset ) Parameters
asset : Reference to the Asset to load asynchronously.
|
LoadObjectAsync | Add an Object to be loaded asynchronously. |
Declaration void LoadAsync( Object *object ) Parameters
object : Reference to the Object to load asynchronously.
|
UnloadObjectAsync | Unload an Object asynchronously. |
Declaration void UnloadObjectAsync( Object *object ) Parameters
object : Reference to the Object to load asynchronously.
|
ClearLoadAsync | Clear the load async. list of a specific type. |
Declaration void ClearLoadAsync( MiscType type )
|
UnloadAsync | Add an Asset to be unloaded asynchronously. |
Declaration void UnloadAsync( Asset *asset ) Parameters
asset : Reference to the Asset to unload asynchronously.
|
ClearUnloadAsync | Clear the unload async. list of a specific type. |
Declaration void ClearUnloadAsync( MiscType type )
|
GetPath | Retrieve the current application path. |
Declaration Return Value
Full filepath of where the application is located.
|
IsRunning | Helper function to determine if the application is running. |
Declaration Return Value
True if the current project is currently running; else return false .
|
GetTouche | Retrieve an active Touche on screen. |
Declaration Touche GetTouche( unsigned char index ) Parameters
index : Index of the touche to retrieve (see AppEvent).
Return Value
Fully filled Touche structure; if the index is invalid the position zeroed.
|
IsGamepad | Helper function to determine if the application is running. |
Declaration bool IsGamepad( unsigned char index ) Return Value
true if a gamepad is associated to the corresponding index received in parameter; false if no gamepad is connected or if the index is out of scope (max. 4).
|
GetGamepad | Retrieve the current states of a specific Gamepad. |
Declaration Gamepad GetGamepad( unsigned char index ) Parameters
index : Index of the gamepad to retrieve (see AppEvent).
Return Value
Fully filled Gamepad structure; if the index is invalid the gamepad name length will be 0 .
|
GetKey | Retrieve a specific Key. |
Declaration Key GetKey( int key_code ) Parameters
key_code : The key code of the Key you want to retrieve.
Return Value
Fully filled Key structure; if the key_code is invalid the key last event app_time will be negative.
|
Callbacks | Description |
OnStart | Occur once when the application start right after the startup_scene is loaded. |
Declaration
|
OnPlay | This callback gets called when the application received the signal to start playing. |
Declaration
|
OnResume | Triggered if the application was paused and then start playing again. |
Declaration
|
OnPause | Triggered when the application gets paused. |
Declaration
|
OnStop | Called when the application received the stop signal. |
Declaration
|
OnLoad | Occur each time a new Scene is loaded. |
Declaration
|
OnUnload | Occur each time a Scene is unloaded. |
Declaration
|
OnUpdate | Triggered once per frame; upon each update. |
Declaration
|
OnDraw | This callback is triggered each time the application is ready to draw a new frame. |
Declaration
|
OnDisplay | This callback happen right after the application have finish draw all Scene. |
Declaration
|
OnTouchesBegan | Triggered when a new input from the pointing device touches the screen. |
Declaration function OnTouchesBegan()
|
OnTouchesMoved | Occur each time a touche is moved on screen. |
Declaration function OnTouchesMoved()
|
OnTouchesEnded | Happen when a touche realease the screen. |
Declaration function OnTouchesEnded()
|
OnAccelerometer | Triggered on each accelerometer updates. |
Declaration function OnAccelerometer()
|
OnGyroscope | This callback occur on each gyroscope updates. |
Declaration
|
OnGamepad | Occur when a gamepad is either plugged in or out. |
Declaration
|
OnGamepadAxis | Occur each time a gamepad axis changes. |
Declaration
|
OnGamepadButtons | Occur each time a gamepad button is pressed or released. |
Declaration function OnGamepadButtons()
|
OnKeyboard | Triggered everytime a key on the keyboard is either pressed or released. |
Declaration
|