Krig Game Engine
Functions
api_engine.cpp File Reference

Krig Game Engine Lua Scripting API - Game (Engine) More...

Functions

void shutdown ()
 
float get_fps ()
 
void render_text (string, float, float)
 
void display_text (string, float, float, float, float, float)
 
bool test_key_pressed (int)
 
bool test_key_released (int)
 
bool test_special_key_pressed (int)
 
bool test_special_key_release (int)
 
bool test_debug_enabled ()
 
Vertex2 get_mouse_coordinates ()
 
void play_sound (GameObjectReference, string)
 
GameObjectReference get_camera ()
 
GameObjectReference get_player ()
 
float get_script_value (GameObjectReference, string)
 
void set_script_value (GameObjectReference, string, float)
 
int luaopen_krigEngine (lua_State *L)
 

Detailed Description

Krig Game Engine Lua Scripting API - Game (Engine)

Game (engine) API functionality.

Function Documentation

◆ display_text()

void display_text ( string  ,
float  ,
float  ,
float  ,
float  ,
float   
)

Display 3D text to the screen.

Parameters
stringtext.
floatx coordinate.
floaty coordinate.
floatz coordinate.
floatscale x.
floatscale y.
Returns
n/a

◆ get_camera()

GameObjectReference get_camera ( )

Get a game object reference to the active camera object.

Returns
GameObjectReference

◆ get_fps()

float get_fps ( )

Query the engine for the last calculated value of frames per second (FPS). Frames per second is calculated each iteration of the game loop.

Returns
float frames per second

◆ get_mouse_coordinates()

Vertex2 get_mouse_coordinates ( )

Query the engine to determine the mouse's last known coordinates.

Returns
Vertex2 - x, y coordinate of the mouse.

◆ get_player()

GameObjectReference get_player ( )

Get a game object reference to the player object.

Returns
GameObjectReference

◆ get_script_value()

float get_script_value ( GameObjectReference  ,
string   
)

Fetch variable value from specified game object's script.

Parameters
GameObjectReference
Returns
string - variable name.

◆ play_sound()

void play_sound ( GameObjectReference  ,
string   
)

Play the sound in the specified wav file.

Parameters
GameObjectReference
string- path to wav file to play.
Returns
n/a

◆ render_text()

void render_text ( string  ,
float  ,
float   
)

Display 2D text to the screen.

Parameters
stringtext.
floatx coordinate.
floaty coordinate.
Returns
n/a

◆ set_script_value()

void set_script_value ( GameObjectReference  ,
string  ,
float   
)

Set variable value in specified game object's script.

Parameters
GameObjectReference
floatvalue.
Returns
string - variable name.

◆ shutdown()

void shutdown ( )

Initiate the Game/Engine shutdown process. This command will kick off clean-up operations and will end with terminating the game.

Returns
n/a

◆ test_debug_enabled()

bool test_debug_enabled ( )

Query the engine for the state of the compiler's DEBUG flag.

Returns
bool

◆ test_key_pressed()

bool test_key_pressed ( int  )

Query the engine to determine if the specified key has been pressed this game cycle.

Parameters
int- integer representation of the key
Returns
bool

◆ test_key_released()

bool test_key_released ( int  )

Query the engine to determine if the specified key has been released this game cycle.

Parameters
int- integer representation of the key
Returns
bool

◆ test_special_key_pressed()

bool test_special_key_pressed ( int  )

Query the engine to determine if the specified key has been pressed this game cycle.

Parameters
int- integer representation of the special key
Returns
bool

◆ test_special_key_release()

bool test_special_key_release ( int  )

Query the engine to determine if the specified key has been released this game cycle.

Parameters
int- integer representation of the special key
Returns
bool