LoadingScreen Class
A singleton that controls the settings of the loading screen. Demonstration of it gives UNIGINE the time to load all world nodes and resources. You can also show your own loading screen when needed.
A loading screen displays a texture that is usually divided into two parts stacked vertically — the initial and final pictures — which are gradually blended from the beginning up to the end of loading to show the progress. Blending is performed based on the alpha channel of the outro (lower) part of the texture so pseudo-animation can be created using the alpha channel: regions of the lower half with small alpha values will be shown first, regions with larger alpha values will be shown last.
See Also#
-
A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/widgets/ folder:
- loading_screen_00
- loading_screen_01
- loading_screen_02
- Quick Video Guide: How To Customize Loading Screens
LoadingScreen Class
Members
const char * getMessage() const#
Return value
Current text message representing the current loading stage.int getProgress() const#
Return value
Current progress state in the [0, 100] range.void setMessageShadersCompilation ( string compilation ) #
Arguments
- string compilation - The message displayed on shaders compilation.
const char * getMessageShadersCompilation() const#
Return value
Current message displayed on shaders compilation.void setMessageLoadingWorld ( string world ) #
Arguments
- string world - The message displayed on world loading.
const char * getMessageLoadingWorld() const#
Return value
Current message displayed on world loading.void setFontPath ( string path ) #
Arguments
- string path - The path to the font used to render the text (True Type Font).
const char * getFontPath() const#
Return value
Current path to the font used to render the text (True Type Font).void setText ( string text ) #
Arguments
- string text - The text of the loading screen. Can be either a plain or rich text. A number of aliases is available:
- UNIGINE_COPYRIGHT — the UNIGINE copyright text.
- UNIGINE_VERSION — the current UNIGINE version.
- LOADING_PROGRESS — the loading progress going from 0 to 100.
- LOADING_WORLD — the world being loaded (if any).
const char * getText() const#
Return value
Current text of the loading screen. Can be either a plain or rich text. A number of aliases is available:- UNIGINE_COPYRIGHT — the UNIGINE copyright text.
- UNIGINE_VERSION — the current UNIGINE version.
- LOADING_PROGRESS — the loading progress going from 0 to 100.
- LOADING_WORLD — the world being loaded (if any).
void setBackgroundColor ( vec4 color ) #
Arguments
- vec4 color - The background color of the loading screen.
vec4 getBackgroundColor() const#
Return value
Current background color of the loading screen.void setTransform ( vec4 transform ) #
Arguments
- vec4 transform - The Transformation of the loading screen texture:
- Texture size multiplier.
- Window size multiplier.
- Horizontal position in the [0.0f, 1.0f] range.
- Vertical position in the [0.0f, 1.0f] range.
vec4 getTransform() const#
Return value
Current Transformation of the loading screen texture:- Texture size multiplier.
- Window size multiplier.
- Horizontal position in the [0.0f, 1.0f] range.
- Vertical position in the [0.0f, 1.0f] range.
void setTexturePath ( string path ) #
Arguments
- string path - The path to a file with the custom loading screen texture. If the value equals to NULL (0), no texture is used.
const char * getTexturePath() const#
Return value
Current path to a file with the custom loading screen texture. If the value equals to NULL (0), no texture is used.void setThreshold ( int threshold ) #
Arguments
- int threshold - The amount of blur in the [0, 255] range.
int getThreshold() const#
Return value
Current amount of blur in the [0, 255] range.void setEnabled ( int enabled ) #
Arguments
- int enabled - The rendering of the loading screen
int isEnabled() const#
Return value
Current rendering of the loading screenstatic getEventRenderEnd() const#
The event handler signature is as follows: myhandler()Usage Example
Return value
Event reference.static getEventRenderBegin() const#
The event handler signature is as follows: myhandler()Usage Example
Return value
Event reference.void engine.loading_screen.setImage ( Image image ) #
Sets an image for a custom loading screen.Arguments
- Image image - Image to be used as a custom loading screen.
void engine.loading_screen.getImage ( Image image ) #
Returns the current image for a custom loading screen.Arguments
- Image image
void engine.loading_screen.renderInterface ( ) #
Renders a static loading screen. Such a screen does not display any progress.void engine.loading_screen.render ( ) #
Renders the loading screen in the current progress state and with the current stage message.void engine.loading_screen.render ( int progress ) #
Renders a custom loading screen in a given progress state. Use this function in a loop to create a gradual change between the initial (upper opaque part) and the final states (bottom transparent part) of the loading screen texture.Arguments
- int progress - Progress of alpha blending between 2 screens stored in the texture. The value in range [0;100] sets an alpha channel threshold, according to which pixels from the initial (opaque) or final (transparent) screen in the texture are rendered. By the value of 0, the initial screen is loaded. By the value of 100, the final screen is loaded.
void engine.loading_screen.render ( int progress, string message ) #
Renders a custom loading screen in a given progress state and prints a given message. Use this function in a loop to create a gradual change between the initial (upper opaque part) and the final states (bottom transparent part) of the loading screen texture, while printing a custom loading stage.Arguments
- int progress - Progress of alpha blending between 2 loading screens stored in the texture. The value in range [0;100] sets an alpha channel threshold, according to which pixels from the initial (opaque) or final (transparent) loading screen in the texture are rendered. By the value of 0, the initial screen is loaded. By the value of 100, the final screen is loaded.
- string message - message to print representing the loading stage.
void engine.loading_screen.renderForce ( ) #
Renders the loading screen regardless of whether the manual rendering is allowed or not.void engine.loading_screen.renderForce ( string message ) #
Renders the loading screen regardless of whether the manual rendering is allowed or not and prints a given message.Arguments
- string message - message to print that represents the loading stage.
The information on this page is valid for UNIGINE 2.20 SDK.