This module contains common structure that you will use on a regular basis while building an NRG application. On this page you find information about the events and inputs as well as other commonly used global constants and enumerations. In this page you will also get more information about event system, learn how to create them and to retrieve the data available when they happen.

See Also


Special keyboard keycode definitions.

  • fShift: Shift key (left or right).
  • fCtrl: The control key.
  • fAlt: Either left or right Alt key.
  • fCommand: Command key on Mac OSX for PC usually the "Windows" key.
  • fCapsLock: Caps lock.
  • fArrowUp: The up arrow.
  • fArrowDown: The down arrow.
  • fArrowLeft: The left arrow.
  • fArrowRight: The right arrow.
  • fPageUp: The page up key.
  • fPageDown: The page down key.
  • fHome: The home key.
  • fEnd: The end key.
  • fEject: The eject key (typically found on Mac keyboards)


-- You can access a specific Key flag value like this: print( "The value of fArrowUp is " .. Application.KeyCode.fArrowUp )


Constant values representing the available playback state.

  • kStop: The current playback state is set to stop.
  • kPlay: The resource is playing and updating.
  • kPause: The resource is on standby waiting to be resumed (kPlay) or stopped (kStop)
  • kStep: Step once then the resource state is set to kPause.
  • kRecord: Special state only used by the editor when recording Curve or Track.
  • kIdle: The initial state of a LvmThread which put it throttling reducing overhead until it gets started.


-- To access a State constant you can type something like this: print( "The value of kPlay is " .. Application.State.kPlay )


The current screen orientation (only apply when the host is a mobile platform).

  • kPortrait: Default position of the device.
  • kFlipped: Portrait flipped a 180 degree.
  • kLandscapeRight: Portrait rotated at 90 degree.
  • kLandscapeLeft: Portrait rotated at -90 degree


-- Print the different orientations in degree. print( "Portrait:" .. Application.Orientation.kPortrait ) print( "Flipped:" .. Application.Orientation.kFlipped ) print( "LandscapeRight:" .. Application.Orientation.kLandscapeRight ) print( "LandscapeLeft:" .. Application.Orientation.kLandscapeLeft )


This structure allows you to gain realtime information about the current touches (mobile) or mouse (desktop) currently interacting with the screen.

Static Variables

Name Description
start The normalized coordinate of the touche or pointer starting point. **
location The current location of the pointer in normalized screen coordinate. **
delta Represent the difference between the current location and the previous. **
app_time The application time when the touche began. **
modifier Only apply for desktop; this allows you to determine which mouse button have been pressed. **
All mouse/touches coordinates are normalized for a question of compatibility among remote desktops and mobile devices (see Client). To restore the original position of the touche on screen multiply the X and Y coordinate with the current event viewport width and height.


Gives you access to manage the information comming from the gamepad(s) connected to your device. By default the system support up to 4 gamepad connected simultaneously; and each gamepad can have up to 32 buttons and up to 6 axis.

Static Variables

Name Description
name The identifier of the gamepad. **
button_mask A mask where each bit represent which button have been pressed or release (up to 32 buttons). **
axis Retrieve the value of the gamepad axis (up to 4). **


Name Description
IsButtonPressed Helper function to determine if a specific button on the gamepad is pressed. *


Structure that allows you to retrieve the current states and variables of an Application EventType. You can then use theses variables at runtime to build the logic and dynamic aspects of your application.

Static Variables

Name Description
type The EventType type.
material_pass The current material pass number (see Material).
framebuffer_pass The current framebuffer pass number (see FrameBuffer).
scene The current Scene available within the boundary of the event.
renderlayer The current RenderLayer in use when the event occur.
camera The active Camera in use when the event occur.
object The active Object in use when the event occur.
video Video structure responsible for the current event trigger.
action The Action structure that trigger the event.
actioncontroller The ActionController involved in the function callback.
sequence Current Sequence associated with the active callback.
material The current Material in use by the callback.
actor The Actor involved in the Region event.
sensor The active Sensor that trigger a kOnProximity event.
particleemitter The active ParticleEmitter responsible of trigerring the callback.
channel Active Channel in used by the current event.
actionclip The ActionClip that trigger the current event.
strip The specific Strip part of the current Sequence callback.
lod_index Represent the current lod index of the geometry that is currently drawing.
face The current FaceType of the Probe beeing processed.
actuator_index Current Channel actuator index used by the callback.
particles The current Particles data attached to the event triggered by the ParticleEmitter.
contact Structure containing detailed information about the current physics collision.
touche_count Amount of touches on screen or active mouse button pressed.
accelerometer Acceleration vector of the device (updated directly from mobile device accelerometer).
gyroscope The action rotational movement of the device (updated directly from the gyroscope of the mobile device).
gamepad_index Index of the gamepad the trigger an event.
key_pressed Determine if a key is pressed or not during a keyboard key event.


Name Description
key_code The keycode of the keyboard key that trigger the current event.
tap_count Number of times a touche or a mouse button have been clicked.


Static Variables

Name Description
pressed Current state of the key; either true or false.
app_time The last application time a press for change occur.


This structure gives you access to the internal statistics that are gather over frames while rendering. The information contained in this structure vary from the frame rate, to the different sync. and rendering time that are updated during rendering and updates. All time values are represented as follow: 1.0 = 1 sec.

Static Variables

Name Description
fps The amount of frames per seconds rendered on screen.
frame Total amount of frames drawed on screen..
frame_time The average frame rendering time (since the last fps update).


Name Description
delta_time Represent the amount of time it took to draw the previous frame.
app_time The application time since the App:Start() function was called.
time_scale Control the scale of the application delta time.
last_sync The absolute time in milliseconds when the last frame was synced.


This structure contains the data related to the current listener (the one who hear the sounds). The listener is used in conjunction with the Sfx subsystem to determine where in space the sounds are heard from. The listener is usually set to be the player or the camera obeject following the action but it can be set to any Object location.

Static Variables

Name Description
gain Value use to represent the internal volume of the listener.
object The current Object assigned to be the listener.
velocity The velocity of the object set as listener.
auto_velocity Control wether or not the velocity of the listener Object should be calculated automatically.
mute Quick and convenient variable to mute the listener volume.

NRG - API 2022.3.383570 - Thu Jul 28 2022
Copyright © 2022 All Rights Reserved. Terms of Service - Privacy Policy - EULA