List of Variables:

Adding Console Command with Several Arguments

The Console class can be used to create custom user console commands with a different number of arguments. This section provides an example of how to create a custom console command with several arguments.

Arguments argc and argv are used to get the arguments count and arguments vector.

Notice

The first element of argv always keeps the name of a console command. Thus, argc is always >= 1. To get the first passed argument, you should use argv[1].

2. Adding Custom Console Command

Add custom command to the AppWorldLogic.cpp file by using addCommand() function. By adding this code into AppWorldLogic::init() function, the engine adds a new console command on AppWorldLogic class instance initialization.

Return value

intgetNumVariables()

Return value

voidsetOutputCallback(const Ptr<OutputCallback> &func)

Sets a callback function that will be executed when a text is output to the console. The function is useful when you implement a custom console, for example. The callback function must receive 2 arguments:

const char *text - a text that is output to the console,

int level - one of the
LEVEL_* variables that indicate the type of the output text. The value can be important for setting a color for console messages, for example.