Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

GameCallback Class

This class provides an ability to call functions of the other class.

The GameCallback class implementation can be found in the data/framework/game/game_callback.h file.

GameCallback Class

Members


GameCallback ()

Constructor. Creates a new GameCallback class instance.

int createCallback (variable instance, string function, variable arg0 = 0, variable arg1 = 0, variable arg2 = 0, variable arg3 = 0)

Creates a callback for a class instance.

Arguments

  • variable instance - User class instance, for which the callback function is called. If the callback function is static, then the return value is NULL.
  • string function - Name of the callback function.
  • variable arg0 - Function argument, optional.
  • variable arg1 - Function argument, optional.
  • variable arg2 - Function argument, optional.
  • variable arg3 - Function argument, optional.

Return value

1 if the callback is created successfully; otherwise 0.

Unigine::CallbackBase getCallback ()

Returns a callback.

Return value

Callback.

string getFunctionName ()

Returns a callback function name.

Return value

Function name.

int getFunctionId ()

Returns a callback function ID.

Return value

Function ID.

variable getInstance ()

Returns a user class instance, for which a callback is created.

Return value

User class instance. If the callback function is static, then the return value is NULL.

int getNumArgs ()

Returns a number of function arguments.

Return value

Number of function arguments.

int equals (variable instance, string function, int num_args = 0)

Returns a value indicating if a callback meets conditions.

Arguments

  • variable instance - User class instance, for which the function is called. If the callback function is static, then the return value is NULL.
  • string function - Function name.
  • int num_args - Number of function arguments.

Return value

1 if a callback meets conditions; otherwise 0.

int equals (GameCallback c)

Returns a value indicating if callbacks are equal.

Arguments

  • GameCallback c - Second callback to compare with.

Return value

1 if callbacks are equal; otherwise 0.

int isAlive ()

Returns a value indicating if a callback can be called.

Return value

1 if a callback can be called; otherwise 0.

void run ()

Runs a callback function.

string getKey ()

Returns a unique callback identity key.

Return value

Unique identity key.
Last update: 2017-07-03