General functions related to the whole application.
This is a global object that can always be accessed.
local gameTicks = GetApp:GetGameTick();
LogMsg("The game's age is: " .. gameTicks);
number GetEngineVersion()
The current engine version in numerical form, for example, 0.16.
string GetEngineVersionAsString()
The current engine version in string form, for example, “0.16”
nil SetWindowTitle(string newTitle)
If you don’t like the default window text, you can specify your own. Only visible when tabbed out or in windowed mode.
nil SetCursorVisible(boolean bVisible)
Parameters: bVisible - If true, the system cursor (this means the mouse pointer in most cases btw) will be shown, otherwise it’s made invisible.
Vector2 GetScreenSize()
Returns a Vector2 object with the current screen size.
boolean SetScreenSize(number x, number y);
Allows on-the-fly screen size changes by script. Up to you to specify valid resolutions if you’re currently fullscreen.
x | The desired screen width |
y | The desired screen height |
True on success. Except it doesn’t detect errors yet, so I guess always true.
Vector2 GetPreLaunchScreenSize()
Returns a Vector2 object with the size of the screen before novashell was launched. Returns 0,0 if unsupported on the current OS.
nil SetIsWindowed(boolean bWindowed)
Changes the video resolution to full screen or windowed mode. Up to you to make sure the video card can handle it currently...
boolean ParmExists(string parmToFind)
Allows you to check if the game was run with a certain command line parameter or not.
parmToFind | The parm you want to check for, for example, “-cheatmode” or something. |
True if the parm was found.
number GetTick()
The current system time. Generally, you want to use GetGameTick instead.
The current system time in milliseconds.
number GetGameTick()
This is what you use to time things.
The current game time in milliseconds.
nil SetSimulationSpeedMod( number speedModifier)
Setting this to 2 means the game will operate twice as fast. Setting to 0.5 would mean half speed (slow mooootion).
By default, TAB is assigned to make the game run fast using this, it’s good for testing and I recommend that you leave it in as it’s handy for skipping slow sequences for players too.
It can’t be used to cheat, because, well, everything is going fast, not just the player.
nil AddCallbackOnResolutionChange(string callbackName, number entityID)
Allows you to have an entity or global function notified if the screen resolution changes. The callback is automatically deleted when an Entity dies. In the case of a global function, there is no way to unregister it.
//Inside of the an entities OnInit()
GetApp:AddCallbackOnResolutionChange("OnResChange", this:GetID());
//Then, elsewhere in the script, define the function "OnResChange"...
function OnResChange()
LogMsg("interface.lua>> Hey, the screen resolution changed to " .. C_SCREEN_X .. " " .. C_SCREEN_Y .. "!");
//Do stuff like move the GUI or whatever
end
string callBackName | The name of the callback function that should be called. (Must exist in your code) |
entityID | If it’s an Entity function and not a global function, you’ll need to enter the Entity’s ID here. Otherwise, <C_ENTITY_NONE>. |