This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::BootConfig Class

Header: #include <UnigineConfig.h>

A singleton that controls the Engine startup configuration and enables you to customize the boot screen.

Notice
Fonts, textures, or any other resources used in the boot screen cannot be packed into an UNG archive.

Usage Example#

By using the BootConfig class, you can customize the boot screen and change the startup settings and save them to the configuration file for the next engine start-up. For example:

AppSystemLogic.cpp

Source code (C++)
#include "AppSystemLogic.h"
#include <UnigineConfig.h>
#include <UnigineConsole.h>

using namespace Unigine;

/* .. */

int AppSystemLogic::shutdown()
{
	// set the window title
	BootConfig::setWindowTitle("Project Name");
	Console::setString("starting_world", "my_world");

	// customize the boot screen
	BootConfig::setScreenWidth(960);
	BootConfig::setScreenHeight(540);

	BootConfig::setScreenBackgroundColor(Math::vec4_black);
	BootConfig::setScreenTransform(Math::vec4(1.0f, 1.0f, 0.5f, 0.5f));

	BootConfig::setScreenThreshold(16);
	BootConfig::setScreenTexture("textures/boot_screen.png");

	BootConfig::setScreenText("								\
			<p align=\"center\">							\
				<font color=\"#ffffff\" size=\"64\">		\
					<xy x=\"%10\" y=\"%50\"/>Helicopter	\
				</font>										\
			</p>");
	BootConfig::setScreenMessageEngineInit(R"(					\
			<p><font size=\"24\" color=\"#777777\">			\
				Engine initialization.						\
			</font></p>)");
	BootConfig::setScreenMessageFileSystemInit("Custom message for file system initialization.");
	BootConfig::setScreenMessageMaterialsInit("Custom message for materials initialization.");
	BootConfig::setScreenMessagePropertiesInit("Custom message for properties initialization.");
	BootConfig::setScreenMessageShadersCompilation("Custom message for shaders compilation.");

	BootConfig::save();

	return 1;
}

See Also#

BootConfig Class

Members


void setPath ( const char * path ) #

Console: boot_config
Sets a new path to the startup configuration file (default: configs/default.boot). The path can be specified as an absolute path or relative to the -data_path or <project_name> folder if the -project_name is set. To run the application with another boot configuration file, specify the path to it using the ‑boot_config command-line option.

Arguments

  • const char * path - New path to the startup configuration file to be set.

const char * getPath ( ) const#

Console: boot_config
Returns the current path to the startup configuration file (default: configs/default.boot).

Return value

Current path to the startup configuration file.

void setAutosave ( bool autosave ) #

Console: boot_config_autosave
Sets a value indicating if current startup configuration settings are automatically saved to the corresponding config file on loading, closing, and saving the world, as well as on the Engine shutdown.

Arguments

  • bool autosave - true to enable automatic saving of current startup configuration settings; false — to disable it.

bool isAutosave ( ) const#

Console: boot_config_autosave
Returns a value indicating if current startup configuration settings are automatically saved to the corresponding config file on loading, closing, and saving the world, as well as on the Engine shutdown.

Return value

true if automatic saving of current Engine configuration settings is enabled; otherwise, 0.

bool load ( ) #

Console: boot_config_load
Loads Engine startup configuration from the file. To change the path to the configuration file use the setPath() method.

Return value

true if the config is successfully loaded from the file; otherwise, false.

bool save ( ) const#

Console: boot_config_save
Saves the current Engine startup configuration to the file. To change the path to the configuration file use the setPath() method.

Return value

true if the current configuration is successfully saved to the file; otherwise, false.

void reset ( ) #

Resets the settings in the Engine startup configuration file to the default.

void setGuiPath ( const char * path ) #

Sets a path to a GUI skin to be used for the engine interface. The path can be specified as an absolute path or relatively to the data folder.

Arguments

  • const char * path - Path to a GUI skin to be used for the Engine interface (absolute path or path relative to the data folder).

const char * getGuiPath ( ) const#

Returns a path to a GUI skin currently used for the Engine interface. The path can be specified as absolute or relatively to the data folder.

Return value

Path to a GUI skin currently used for the Engine interface (absolute path or path relative to the data folder).

void setEngineLog ( const char * log ) #

Sets a log file (in txt format) to be created and used by the Engine. The path can be absolute or relative to the binary executable. For relative paths, if the Project Name startup parameter is set, the log file with the specified name will be created in the corresponding directory in the User profile (only the name will be used, the remaining part of the relative path will be discarded).

Arguments

  • const char * log - Log file (in txt format) to be used by the Engine.

const char * getEngineLog ( ) const#

Returns a log file (in txt format) currently used by the Engine. The path can be absolute or relative to the binary executable. For relative paths, if the Project Name startup parameter is set, the log file with the specified name will be created in the corresponding directory in the User profile (only the name will be used, the remaining part of the relative path will be discarded).

Return value

Log file (in txt format) currently used by the Engine.

void setSystemScript ( const char * script ) #

Sets a new path to the system script (corresponds to the system_script element of the .boot configuration file).

Arguments

  • const char * script - Path to the system script (specified relative to the data folder).

const char * getSystemScript ( ) const#

Returns the path to the system script (corresponds to the system_script element of the .boot configuration file).

Return value

Path to the system script (specified relative to the data folder).

void setEditorScript ( const char * script ) #

Sets a new path to the editor script (corresponds to the system_script element of the .boot configuration file).

Arguments

  • const char * script - Path to the editor script (specified relative to the data folder).

const char * getEditorScript ( ) const#

Returns the path to the editor script (corresponds to the system_script element of the .boot configuration file).

Return value

Path to the editor script (specified relative to the data folder).

void setCachePath ( const char * path ) #

Sets a new path to store system and Editor cache files(corresponds to the cache_path element of the .boot configuration file).

Arguments

  • const char * path - Path to store system and Editor cache files. Can be an absolute path or a relative path to the data path.

const char * getCachePath ( ) const#

Returns the current path to store system and Editor cache files(corresponds to the cache_path element of the .boot configuration file).

Return value

Path to store system and Editor cache files. Can be an absolute path or a relative path to the data path.

void setEditorCache ( const char * cache ) #

Sets a new path to a cache file to be used by the UnigineEditor (corresponds to the editor_cache element of the .boot configuration file).

Arguments

  • const char * cache - Path to a cache file to be used by the UnigineEditor. Can be an absolute path or a path relative to the data path, or to the cache path (if any).

const char * getEditorCache ( ) const#

Returns the path to a cache file currently used by the UnigineEditor (corresponds to the editor_cache element of the .boot configuration file).

Return value

Path to a cache file to be used by the UnigineEditor. Can be an absolute path or a path relative to the data path, or to the cache path (if any).

void setSystemCache ( const char * cache ) #

Sets a new path to a cache file to be used by the Engine (corresponds to the system_cache element of the .boot configuration file).

Arguments

  • const char * cache - Path to a cache file currently used by the Engine. Can be an absolute path or a path relative to the data path, or to the cache path (if any).

const char * getSystemCache ( ) const#

Returns the current path to a cache file to be used by the Engine (corresponds to the system_cache element of the .boot configuration file).

Return value

Path to a cache file currently used by the Engine. Can be an absolute path or a path relative to the data path, or to the cache path (if any).

void setVideoApp ( const char * app ) #

Sets a new graphics API to be used for rendering. (corresponds to the video_app element of the .boot configuration file).

Arguments

  • const char * app - Graphics API used for rendering: null, auto, dx, or gl.

const char * getVideoApp ( ) const#

Returns the graphics API currently used for rendering (corresponds to the video_app element of the .boot configuration file).

Return value

Graphics API used for rendering: null, auto, dx, or gl.

void setSoundApp ( const char * app ) #

Sets a new sound API to be used (corresponds to the sound_app element of the .boot configuration file).

Arguments

  • const char * app - Sound API used for rendering: nosound, auto, or openal.

const char * getSoundApp ( ) const#

Returns the sound API currently used (corresponds to the sound_app element of the .boot configuration file).

Return value

Sound API used for rendering: nosound, auto, or openal.

void setExternDefine ( const char * defines ) #

Sets extern define(s) to be used at the Engine startup (corresponds to the extern_define element of the .boot configuration file).

Arguments

  • const char * defines - External definition(s) to be used. Several definitions are comma separated (no whitespaces). Definitions can be specified as follows:
    • DEFINITION_NAME
    • DEFINITION_NAME=VALUE
    • DEFINITION_NAME_1,DEFINITION_NAME_2,
      DEFINITION_NAME_3=VALUE,...,DEFINITION_NAME_N

const char * getExternDefine ( ) const#

Returns extern define(s) currently used at the Engine startup (corresponds to the extern_define element of the .boot configuration file).

Return value

External definition(s) to be used. Several definitions are comma separated (no whitespaces). Definitions can be specified as follows:
  • DEFINITION_NAME
  • DEFINITION_NAME=VALUE
  • DEFINITION_NAME_1,DEFINITION_NAME_2,
    DEFINITION_NAME_3=VALUE,...,DEFINITION_NAME_N

void setConsoleCommand ( const char * command ) #

Sets a new Console command(s) to be used at the Engine startup (corresponds to the console_command element of the .boot configuration file).

Arguments

  • const char * command - Console command(s) to be used at the engine startup. Several commands can be separated using the && sequence.

const char * getConsoleCommand ( ) const#

Returns Console command(s) currently used at the Engine startup (corresponds to the console_command element of the .boot configuration file).

Return value

Console command(s) currently used at the Engine startup. Several commands can be separated using the && sequence.

int getNumPluginPaths ( ) const#

Returns the number of directory(ies) containing plugins to be automatically loaded at the Engine startup. These directories are specified in the .boot configuration file via the plugin_path element. The list of these plugin paths can be obtained via the getNumPluginPaths() and getPluginPath(int num) methods. The order of loading plugins matters, you can rearrange the paths via swapPluginPath()

Return value

Current number of plugin directories.

void removePluginPath ( int num ) #

Removes a plugin path with the specified number from the list of the plugin paths specified in the .boot configuration file via the plugin_path element. A plugin path is a directory containing plugins to be automatically loaded at the Engine startup.

Arguments

void swapPluginPath ( int num0, int num1 ) #

Swaps two plugin paths with the given numbers specified in the .boot configuration file. A plugin path is a directory containing plugins to be automatically loaded at the Engine startup. The list of these plugin paths can be obtained via the getNumPluginPaths() and getPluginPath(int num) methods. The order of loading plugins matters, you can rearrange the paths via swapPluginPath()

Arguments

const char * getPluginPath ( int num ) #

Returns a plugin path with the given number specified in the .boot configuration file via the plugin_path element. A plugin path is a directory containing plugins to be automatically loaded at the Engine startup. The order of loading plugins matters, you can rearrange the paths via swapPluginPath().

Arguments

Return value

Path to the plugins directory with the given number in the list of the plugin paths. Сan be absolute or specified relatively to the binary executable.

void setPluginPath ( int num, const char * value ) #

Sets a new path for the item of the list of the plugin paths with the given number specified in the .boot configuration file via the plugin_path element. A plugin path is a directory containing plugins to be automatically loaded at the Engine startup. The order of loading plugins matters, you can rearrange the paths via swapPluginPath().

Arguments

  • int num - Plugin path number in the list of the specified plugin paths.
  • const char * value - New path to be set for the specified item of the list of the plugin paths. Сan be specified relatively to the binary executable or as an absolute path.

int getNumExternPlugins ( ) const#

Returns the number of plugin libraries to be automatically loaded at the Engine startup. These plugins are specified in the .boot configuration file via the extern_plugin element. The list of these plugin paths can be obtained via the getNumExternPlugins() and getExternPlugin(int num) methods. The order of loading plugins matters, you can rearrange them via swapPluginPath().

Return value

Current number of plugin libraries to be loaded at the Engine startup.

void removeExternPlugin ( int num ) #

Removes a plugin with the specified number from the list of the plugins specified in the .boot configuration file via the extern_plugin element.

Arguments

void swapExternPlugin ( int num0, int num1 ) #

Swaps two plugins with the given numbers specified in the .boot configuration file. The list of these plugins can be obtained via the getNumExternPlugins() and getExternPlugin(int num) methods. The order of loading plugins matters, this method enables you to rearrange plugins to change loading order.

Arguments

const char * getExternPlugin ( int num ) #

Returns the name of the plugin with the given number specified in the .boot configuration file via the extern_plugin element. The order of loading plugins matters, you can rearrange the paths via swapExternPlugin().

Arguments

Return value

Name of the plugin with the given number specified in the .boot configuration file. Plugin library name goes without any prefixes and postfixes (e.g., libNetwork_x64d.so is listed as "Network").

void setExternPlugin ( int num, const char * value ) #

Sets a new name of the plugin with the given number specified in the .boot configuration file via the extern_plugin element. The order of loading plugins matters, you can rearrange the paths via swapExternPlugin().

Arguments

  • int num - Number of the plugin to be set in the list of the specified plugins, in the range from 0 to the total number of plugins specified.
  • const char * value - Name of the plugin with the given number specified in the .boot configuration file. Plugin library name goes without any prefixes and postfixes (e.g., libNetwork_x64d.so is listed as "Network").

void setScreenWidth ( int width = 860 ) #

Sets the width of the boot screen window, in pixels.

Arguments

  • int width - Width of the boot screen window, in pixels.

int getScreenWidth ( ) const#

Returns the current width of the boot screen window.

Return value

Current width of the boot screen window, in pixels.

void setScreenHeight ( int height = 560 ) #

Sets the height of the boot screen window, in pixels.

Arguments

  • int height - Height of the boot screen window, in pixels.

int getScreenHeight ( ) const#

Returns the height of the boot screen window, in pixels.

Return value

Current height of the boot screen window, in pixels.

void setScreenBackgroundColor ( const Math::vec4 & color ) #

Sets the background color of the screen. The default value is vec4_zero.

Arguments

  • const Math::vec4 & color - Background color defined by a vector of four numbers in the [0; 1] range.

Math::vec4 getScreenBackgroundColor ( ) const#

Returns the current background color of the screen.

Return value

Background color defined by a vector of four numbers in the [0; 1] range.

void setScreenTransform ( const Math::vec4 & transform ) #

Sets the transformation of the boot screen texture. The default value is vec4(1.0f, 1.0f, 0.5f, 0.5f).

Arguments

  • const Math::vec4 & transform - Transformation of the screen defined by a vector of four numbers in the [0; 1] range:
    1. Texture size multiplier
    2. Window size multiplier
    3. Horizontal position
    4. Vertical position

Math::vec4 getScreenTransform ( ) const#

Returns the current transformation of the boot screen texture.

Return value

Transformation of the screen defined by a vector of four numbers in the [0; 1] range:
  1. Texture size multiplier
  2. Window size multiplier
  3. Horizontal position
  4. Vertical position

void setScreenThreshold ( int threshold = 16 ) #

Sets the threshold for blending based on the alpha-channel.

Arguments

  • int threshold - Threshold for blending based on the alpha-channel.

int getScreenThreshold ( ) const#

Returns the current threshold for blending based on the alpha-channel.

Return value

Threshold for blending based on the alpha-channel.

void setScreenTexture ( const char * texture ) #

Sets the path to the boot screen texture.
Notice
Textures or any other resources used in the Boot screen cannot be packed into an UNG archive.

Arguments

  • const char * texture - Path to the boot screen texture.

const char * getScreenTexture ( ) const#

Returns the current path to the boot screen texture.

Return value

Path to the boot screen texture.

void setScreenFont ( const char * font ) #

Sets the path to the font for text rendering.
Notice
Fonts or any other resources used in the Boot screen cannot be packed into an UNG archive.

Arguments

  • const char * font - Path to the font for text rendering.

const char * getScreenFont ( ) const#

Returns the current path to the font for text rendering.

Return value

Path to the font for text rendering.

void setScreenText ( const char * text ) #

Sets the text of the boot screen.

Arguments

  • const char * text - Text of the boot screen. Can be either a plain or rich text. A number of aliases is provided:
    • UNIGINE_COPYRIGHT — the UNIGINE copyright text.
    • UNIGINE_VERSION — the current UNIGINE version.
    • LOADING_PROGRESS — the loading progress going from 0 to 100.

const char * getScreenText ( ) const#

Returns the current text of the boot screen.

Return value

Text of the boot screen.

void setScreenMessageEngineInit ( const char * init ) #

Sets the message to be displayed on the engine initialization. The message is set the same way as the screen text.

Arguments

  • const char * init - Message on the engine initialization.

const char * getScreenMessageEngineInit ( ) const#

Returns the message currently displayed on the engine initialization.

Return value

Message on the engine initialization.

void setScreenMessageFileSystemInit ( const char * init ) #

Sets the message to be displayed on the file system initialization. The message is set the same way as the screen text.

Arguments

  • const char * init - Message for file system initialization.

const char * getScreenMessageFileSystemInit ( ) const#

Returns the message currently displayed on the file system initialization.

Return value

Message for file system initialization.

void setScreenMessageMaterialsInit ( const char * init ) #

Sets the message to be displayed on materials initialization. The message is set the same way as the screen text.

Arguments

  • const char * init - Message for materials initialization.

const char * getScreenMessageMaterialsInit ( ) const#

Returns the message currently displayed on materials initialization.

Return value

Message for materials initialization.

void setScreenMessagePropertiesInit ( const char * init ) #

Sets the message to be displayed on properties initialization. The message is set the same way as the screen text.

Arguments

  • const char * init - Message for properties initialization.

const char * getScreenMessagePropertiesInit ( ) const#

Returns the message currently displayed on properties initialization.

Return value

Message for properties initialization.

void setScreenMessageShadersCompilation ( const char * compilation ) #

Sets the message to be displayed on shaders compilation. The message is set the same way as the screen text.

Arguments

  • const char * compilation - Message for shaders compilation.

const char * getScreenMessageShadersCompilation ( ) const#

Returns the message currently displayed on shaders compilation.

Return value

Message for shaders compilation.

void setWindowTitle ( const char * title ) #

Sets a new title for the application window.

Arguments

  • const char * title - New application window title to be set.

const char * getWindowTitle ( ) const#

Returns the current application window title.

Return value

Current application window title.

static void setWindowIconPath ( const char * path ) #

Sets the path to the custom icon for the final application's window.

Arguments

  • const char * path - Path to the custom icon for the final application's window.

static const char * getWindowIconPath ( ) #

Returns the path to the custom icon for the final application's window.

Return value

Path to the custom icon for the final application's window.

void setScreenEnabled ( bool enabled ) #

Sets the value indicating if the boot screen is enabled.

Arguments

  • bool enabled - true to enable the boot screen; false — to disable it.

bool isScreenEnabled ( ) const#

Returns the value indicating if the boot screen is enabled.

Return value

true if the boot screen is enabled; otherwise, false.
Last update: 2023-06-23
Build: ()