This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Engine Class

This set of functions specifies the path to the Unigine engine and its basic parameters.

virtual ~Engine ()

Virtual destructor.

static Engine * init (int version, int argc, char ** argv, const char * project, const char * password)

Initializes a new engine instance.

Arguments

  • int version - Engine version number (UNIGINE_VERSION).
  • int argc - Number of command line arguments.
  • char ** argv - Array of values of command line arguments.
  • const char * project - Project name. If this parameter is set, it forces the engine to store rewritable data (such as log file, cache files, config files) in user profile rather than in a directory with binaries. Notice that only the project name is required to pass in for this parameter, not the full path to the project. If there is no need to change location of such files, pass the NULL value.
  • const char * password - Password for the filesystem archives. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password.

Return value

Pointer to the new engine instance.

static Engine * init (int version, int argc, wchar_t ** argv, const char * project, const char * password)

Initializes a new engine instance.

Arguments

  • int version - Engine version number (UNIGINE_VERSION).
  • int argc - Number of command line arguments.
  • wchar_t ** argv - Array of values of command line arguments (a wide-character string).
  • const char * project - Project name. If this parameter is set, it forces the engine to store rewritable data (such as log file, cache files, config files) in user profile rather than in a directory with binaries. Notice that only the project name is required to pass in for this parameter, not the full path to the project. If there is no need to change location of such files, pass the NULL value.
  • const char * password - Password for the filesystem archives. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password.

Return value

Pointer to the new engine instance.

static Engine * init (int version, App * app, int argc, char ** argv, const char * project, const char * password)

Initializes a new engine instance to be used with an external graphics application.

Arguments

  • int version - Version number (UNIGINE_VERSION).
  • App * app - Pointer to the graphics App class. Pass the NULL value to ignore this parameter.
  • int argc - Number of command line arguments.
  • char ** argv - Array of values of command line arguments.
  • const char * project - Project name. If this parameter is set, it forces the engine to store rewritable data (such as log file, cache files, config files) in user profile rather than in a directory with binaries. Notice that only the project name is required to pass in for this parameter, not the full path to the project. If there is no need to change location of such files, pass the NULL value.
  • const char * password - Password for the filesystem archives. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password.

Return value

Pointer to the new engine instance.

static Engine * init (int version, App * app, int argc, wchar_t ** argv, const char * project, const char * password)

Initializes a new engine instance to be used with an external graphics application.

Arguments

  • int version - Version number (UNIGINE_VERSION).
  • App * app - Pointer to the graphics App class. Pass the NULL value to ignore this parameter.
  • int argc - Number of command line arguments.
  • wchar_t ** argv - Array of values of command line arguments (a wide-character string).
  • const char * project - Project name. If this parameter is set, it forces the engine to store rewritable data (such as log file, cache files, config files) in user profile rather than in a directory with binaries. Notice that only the project name is required to pass in for this parameter, not the full path to the project. If there is no need to change location of such files, pass the NULL value.
  • const char * password - Password for the filesystem archives. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password.

Return value

Pointer to the new engine instance.

static Engine * init (int version, App * app, const char * app_path, const char * home_path, int argc, char ** argv, const char * project, const char * password)

Initializes a new engine instance to be used with an external graphics application, which is stored at the specified path.

Arguments

  • int version - Version number (UNIGINE_VERSION).
  • App * app - Pointer to the graphics App class. Pass the NULL value to ignore this parameter.
  • const char * app_path - Path to a directory where binary executable file is stored. Pass the NULL value to ignore this parameter.
  • const char * home_path - Path to the user's home directory.
  • int argc - Number of command line arguments.
  • char ** argv - Array of values of command line arguments.
  • const char * project - Project name. If this parameter is set, it forces the engine to store rewritable data (such as log file, cache files, config files) in user profile rather than in a directory with binaries. Notice that only the project name is required to pass in for this parameter, not the full path to the project. If there is no need to change location of such files, pass the NULL value.
  • const char * password - Password for the filesystem archives. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password.

Return value

Pointer to the new engine instance.

static Engine * init (int version, App * app, const char * app_path, const char * home_path, int argc, wchar_t ** argv, const char * project, const char * password)

Initializes a new engine instance to be used with an external graphics application, which is stored at the specified path.

Arguments

  • int version - Version number (UNIGINE_VERSION).
  • App * app - Pointer to the graphics App class. Pass the NULL value to ignore this parameter.
  • const char * app_path - Path to a directory where binary executable file is stored. Pass the NULL value to ignore this parameter.
  • const char * home_path - Path to the user's home directory.
  • int argc - Number of command line arguments.
  • wchar_t ** argv - Array of values of command line arguments (a wide-character string).
  • const char * project - Project name. If this parameter is set, it forces the engine to store rewritable data (such as log file, cache files, config files) in user profile rather than in a directory with binaries. Notice that only the project name is required to pass in for this parameter, not the full path to the project. If there is no need to change location of such files, pass the NULL value.
  • const char * password - Password for the filesystem archives. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password. Notice that the specified password must be the same as for the project archive (if it exists). Pass the NULL value if you do not need to set a password.

Return value

Pointer to the new engine instance.

static void shutdown ()

Deletes the pointer to the existing engine instance.

static Engine * get ()

Returns a pointer to the existing engine instance.

Return value

Pointer to the existing engine.

static int isInitialized ()

Returns the status of the engine.

Return value

Returns 1 if the engine is initialized; otherwise, 0.

virtual int getNumArgs () const =0

Returns the number of command line arguments.

Return value

Number of command line arguments.

virtual const char * getArg (int num) const =0

Returns a command line argument by its index.

Arguments

  • int num - Command line argument index.

Return value

Command line argument, string.

virtual int getArgi (int num) const =0

Returns an integer command line argument by its index.

Arguments

  • int num - Command line argument index.

Return value

Command line argument, integer.

virtual float getArgf (int num) const =0

Returns a floating point command line argument by its index.

Arguments

  • int num - Command line argument index.

Return value

Command line argument, float.

virtual int getNumPlugins () const =0

Returns the number of loaded plugins.

Return value

Number of loaded plugins.

virtual int findPlugin (const char * name) const =0

Finds the plugin by its name.

Arguments

  • const char * name - Name of the plugin.

Return value

Number of the plugin.

virtual const char * getPluginName (int num) const =0

Returns the name of the loaded plugin by its index.

Arguments

  • int num - Index of the loaded plugin.

Return value

Loaded plugin name.

virtual Plugin * getPluginInterface (int num) const =0

Returns the loaded plugin interface.

Arguments

  • int num - Index of the loaded plugin.

Return value

Returns interface of the loaded plugin, if it exists; otherwise, NULL.

virtual void * getPluginData (int num) const =0

Returns the loaded plugin data.

Arguments

  • int num - Index of the loaded plugin.

Return value

Returns data of the loaded plugin, if it exists; otherwise, NULL.

virtual int addPlugin (const char * name) const =0

Adds a plugin in engine runtime by using a name of this plugin.

Arguments

  • const char * name - Plugin name.

virtual int addPlugin (Plugin * plugin) const =0

Adds a plugin in engine runtime by using a pointer to this plugin.

Arguments

  • Plugin * plugin - Plugin pointer.

virtual int removePlugin (Plugin * plugin) const =0

Removes a plugin by using a pointer to this plugin.

Arguments

  • Plugin * plugin - Plugin pointer to remove.

virtual const char * getAppPath () const =0

Returns a path to the binary executable file.

Return value

Path to the executable file.

virtual const char * getDataPath () const =0

Returns a path to the root data directory.

Return value

Path to the data directory.

virtual const char * getHomePath () const =0

Returns a path to the user's home directory.

Return value

Path to the user's home directory.

virtual const char * getSavePath () const =0

Returns a path where a default configuration file, save files and screenshots will be stored.

Return value

Path to a directory for default configuration file, save files, etc.

virtual const char * getCachePath () const =0

Returns a path where cache files will be stored.

Return value

Path to a directory for cache files.

virtual int isDone () const =0

Returns the engine "done" flag on quit.

Return value

Returns 1 when engine is quitting; otherwise, 0.

virtual void update () const =0

Engine update function. This function must be called every frame.

virtual void render () const =0

Engine rendering function. This function must be called every frame.

virtual void swap () const =0

Engine swap buffers function. This function must be called every frame.

virtual void main () const =0

Engine main loop. Replaces while(isDone() == 0) { update(): render(); swap(); } commands.

virtual int isSystemInterpreter () const =0

Checks if the function is called from the system script.

Return value

Returns 1 when the function is called from the system script; otherwise, 0.

virtual void * getSystemInterpreter () const =0

Returns a pointer to the system interpreter.

Return value

Pointer to the system interpreter.

virtual int isSystemVariable (const char * name) const =0

Checks whether a system script variable exists.

Arguments

  • const char * name - Name of the system script variable.

Return value

Returns 1 if the system script variable exists; otherwise, 0.

virtual void setSystemVariable (const char * name, const Variable & v) const =0

Sets a system script variable by a name.

Arguments

  • const char * name - Name of the system script variable.
  • const Variable & v - Value of the system script variable.

virtual const Variable & getSystemVariable (const char * name) const =0

Returns the system script variable by its name.

Arguments

  • const char * name - Name of the system script variable.

Return value

System script variable.

virtual int isSystemFunction (const char * name, int num_args) const =0

Checks whether the system script function exists.

Arguments

  • const char * name - Name of the system script function.
  • int num_args - Number of system script function arguments.

Return value

Returns 1 if the system script function exists; otherwise, 0.

virtual int getSystemFunction (const char * name, int num_args) const =0

Returns the system function identifier.

Arguments

  • const char * name - Name of the system script function.
  • int num_args - Number of system script function arguments.

Return value

Returns system script function identifier.

virtual const Variable & runSystemFunction (const Variable & name) const =0

Runs the system script function by its name. The target function can receive up to 8 arguments.

Arguments

  • const Variable & name - Name of the system script function.

Return value

System script function return value.

virtual const Variable & runSystemFunction (const Variable & name, const Variable * args, int num_args) const =0

Runs system script function by its name.

Arguments

  • const Variable & name - Name of the system script function.
  • const Variable * args - Pointer to system script function arguments.
  • int num_args - Number of system script function arguments.

Return value

System script function return value.

virtual int isWorldLoaded () const =0

Returns a value indicating if the world script is loaded.

Return value

Returns 1 if the world script is loaded; otherwise, 0.

virtual int isWorldInterpreter () const =0

Returns a value indicating if the function is called from the world script.

Return value

Returns 1 if the function is called from the world script; otherwise, 0.

virtual void * getWorldInterpreter () const =0

Returns a pointer to the world interpreter.

Return value

Pointer to the world interpreter.

virtual int isWorldVariable (const char * name) const =0

Returns a value indicating if the world script variable exists.

Arguments

  • const char * name - Name of the world script variable.

Return value

Returns 1 if the world script variable exists; otherwise, 0.

virtual void setWorldVariable (const char * name, const Variable & v) const =0

Sets a world script variable by its name.

Arguments

  • const char * name - Name of the world script variable.
  • const Variable & v - Value of the world script variable.

virtual const Variable & getWorldVariable (const char * name) const =0

Returns a world script variable by its name.

Arguments

  • const char * name - Name of the world script variable.

Return value

World script variable.

virtual int isWorldFunction (const char * name, int num_args) const =0

Returns value indicating if the world script function exists.

Arguments

  • const char * name - Name of the world script function.
  • int num_args - Number of world script function arguments.

Return value

Returns 1 if the world script function exists; otherwise, 0.

virtual int getWorldFunction (const char * name, int num_args) const =0

Returns the world function identifier.

Arguments

  • const char * name - Name of the world script function.
  • int num_args - Number of world script function arguments.

Return value

Returns world script function identifier.

virtual const Variable & runWorldFunction (const Variable & name) const =0

Runs the world script function by its name. The target function can receive up to 8 arguments.

Arguments

  • const Variable & name - Name of the world script function.

Return value

World script function return value.

virtual const Variable & runWorldFunction (const Variable & name, const Variable * args, int num_args) const =0

Runs the world script function by its name.

Arguments

  • const Variable & name - Name of the world script function.
  • const Variable * args - Pointer to world script function arguments.
  • int num_args - Number of world script function arguments.

Return value

World script function return value.

virtual int isEditorLoaded () const =0

Returns a value indicating if the editor script is loaded.

Return value

Returns 1 if the editor script is loaded; otherwise, 0.

virtual int isEditorInterpreter () const =0

Returns a value indicating if the function is called from the editor script.

Return value

Returns 1 if the function is called from the editor script; otherwise, 0.

virtual void * getEditorInterpreter () const =0

Returns pointer to the editor interpreter.

Return value

Pointer to the editor interpreter.

virtual int isEditorVariable (const char * name) const =0

Returns a value indicating if the editor script variable exists.

Arguments

  • const char * name - Name of the editor script variable.

Return value

Returns 1 if the editor script variable exists; otherwise, 0.

virtual void setEditorVariable (const char * name, const Variable & v) const =0

Sets the editor script variable by its name.

Arguments

  • const char * name - Name of the editor script variable.
  • const Variable & v - Value of the editor script variable.

virtual const Variable & getEditorVariable (const char * name) const =0

Returns the editor script variable by its name.

Arguments

  • const char * name - Name of the world script variable.

Return value

Value of the editor script variable.

virtual int isEditorFunction (const char * name, int num_args) const =0

Returns a value indicating if the editor script function exists.

Arguments

  • const char * name - Name of the editor script function.
  • int num_args - Number of editor script function arguments.

Return value

Returns 1 if the editor script function exists; otherwise, 0.

virtual int getEditorFunction (const char * name, int num_args) const =0

Returns the editor function identifier.

Arguments

  • const char * name - Name of the editor script function.
  • int num_args - Number of editor script function arguments.

Return value

Returns editor script function identifier.

virtual const Variable & runEditorFunction (const Variable & name) const =0

Runs the editor script function by its name. The target function can receive up to 8 arguments.

Arguments

  • const Variable & name - Name of the editor script function.

Return value

Editor script function return value.

virtual const Variable & runEditorFunction (const Variable & name, const Variable * args, int num_args) const =0

Runs the editor script function by its name.

Arguments

  • const Variable & name - Name of the editor script function.
  • const Variable * args - Pointer to editor script function arguments.
  • int num_args - Number of editor script function arguments.

Return value

Editor script function return value.
Last update: 2017-07-03
Build: ()