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
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

engine.splash Functions

This set of functions controls the settings of the splash screen. Demonstration of it gives Unigine the time to load all world and compile shaders. For a splash screen a two-part texture can be set.

Function that displays a texture splash screen is usually divided into two parts — intro and outro, though there can be more of them; this is achieved with the yield operator. At this point the intro part is displayed. Intro parts usually consist of two images, which are gradually blended with different coefficients to show the progress.

int engine.splash.isEnabled ()

Returns a value indicating if manual rendering of a splash screen (on system loading, world loading or of a custom one) is allowed.
Notice
Setter function engine.splash.setEnabled() is used only together with corresponding render functions (engine.splash.renderSystem(), engine.splash.renderWorld() or engine.splash.renderSplash()). It cannot be used to enable or disable rendering of a system or a world splash screen during the initialization stage of the script.

Return value

1 if the rendering of the splash screen was enabled; otherwise, 0.

void engine.splash.renderInterface ()

Renders a static splash screen. Such a splash screen does not display any progress.

void engine.splash.renderSplash (int progress)

Renders a custom splash 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 splash screen texture.

Arguments

  • int progress - Progress of alpha blending between 2 splash 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) splash 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.

Examples

Source code (UnigineScript)
//To avoid one-frame black screen before loading of the world starts, use the following:

int init() {

systemInit();

//set the splash screen texture
engine.splash.setSplash("data/splash.png");

//allow rendering of a custom splash screen
engine.splash.setEnabled(1);
//render a static splash screen image (opaque upper part of the texture) for one frame before the world splash screen starts loading
engine.splash.renderSplash(0);
//disallow rendering of a splash screen
engine.splash.setEnabled(0);

return 1;
}

void engine.splash.renderSystem (int progress)

Renders a splash screen image, that is displayed by the system script reload, 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 splash screen texture.

Arguments

  • int progress - Progress of alpha blending between 2 splash 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) parts of the texture are rendered. By the value of 0, the initial screen is loaded. By the value of 100, the final screen is loaded.

Examples

Source code (UnigineScript)
//render a static world splash screen image (opaque upper part of the texture) for one frame
engine.splash.setEnabled(1);
engine.splash.renderSystem(0);
engine.splash.setEnabled(0);

void engine.splash.renderWorld (int progress)

Renders a splash screen image, that is displayed by the world load, 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 splash screen texture.

Arguments

  • int progress - Progress of alpha blending between 2 splash 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) parts of the texture are rendered. By the value of 0, the initial screen is loaded. By the value of 100, the final screen is loaded.

Examples

Source code (UnigineScript)
//render a static world splash screen image (opaque upper part of the texture) for one frame
engine.splash.setEnabled(1);
engine.splash.renderWorld(0);
engine.splash.setEnabled(0);

void engine.splash.setColor (vec4 color)

Sets the color of the text LOADING on the black background. This text is displayed, when a splash screen being called is cleared.

Arguments

  • vec4 color - Text color.

void engine.splash.setEnabled (int enable)

Specifies if manual rendering of a splash screen (on system loading, world loading or of a custom one) can be started or should be stopped. This function is used only together with corresponding render functions (engine.splash.renderSystem(), engine.splash.renderWorld() or engine.splash.renderSplash()).
Notice
This function cannot be used to enable or disable rendering of a system or a world splash screen during the initialization stage of the script.

Arguments

  • int enable - Positive integer to enable rendering of the splash screen; 0 to disable.

void engine.splash.setSplashBackground (vec4 color)

Sets the background color of the splash screen.

Arguments

  • vec4 color - Background color.

void engine.splash.setSplashImage (Image image, int threshold = 0)

Sets an image for a custom splash screen. This splash screen can be called from the script any time you need it. The splash screen is a two-part texture shown according to the threshold.

Arguments

  • Image image - Image to be used as a custom splash screen.
  • int threshold - Amount of blur in the alpha channel when interpolating between states of the splash screen. This is an optional parameter; if it is not passed, 0 will be used instead.

void engine.splash.setSplashText (string text)

Sets the text of the splash screen.

Arguments

  • string text - Text of the splash screen.

void engine.splash.setSplashTransform (vec4 transform)

Sets transformation of the splash.

Arguments

  • vec4 transform - Transformation of the splash.

void engine.splash.setSplash (string name, int threshold = 0)

Sets basic properties of a custom splash screen. This splash screen can be called from the script any time you need it. The splash screen is a two-part texture.

Arguments

  • string name - Name of the file with the custom splash screen. If NULL (0) is passed, the splash screen is cleared.
  • int threshold - Amount of blur in the alpha channel when interpolating between states of the splash screen. This is an optional parameter; if it is not passed, 0 will be used instead.

void engine.splash.setSystemBackground (vec4 color)

Sets the background color of the system splash screen.

Arguments

  • vec4 color - Background color.

void engine.splash.setSystemImage (Image image, int threshold = 0)

Sets an image for a system splash screen, which is displayed while resources like shaders and materials are being loaded on the engine start-up. The splash screen is a two-part texture shown according to the threshold.

Arguments

  • Image image - Image to be used as a system splash screen.
  • int threshold - Amount of blur in the alpha channel when interpolating between states of the splash screen. This is an optional parameter; if it is not passed, 0 will be used instead.

void engine.splash.setSystemText (string text)

Sets the text of the system splash screen.

Arguments

  • string text - Text of the system splash screen.

void engine.splash.setSystemTransform (vec4 transform)

Sets transformation of the system splash.

Arguments

  • vec4 transform - Transformation of the system splash.

void engine.splash.setSystem (string name, int threshold = 0)

Sets basic properties of a system splash screen, which is displayed while resources like shaders and materials are being loaded on the engine start-up. The splash screen is a two-part texture.
Notice
If NULL is set for a splash screen texture, LOADING text will be shown instead.

Arguments

  • string name - Name of the file with the system splash screen. If NULL (0) is passed, the splash screen is cleared.
  • int threshold - Amount of blur in the alpha channel when interpolating between states of the splash screen. This is an optional parameter; if it is not passed, 0 will be used instead.

void engine.splash.setWorldBackground (vec4 color)

Sets the background color of the world splash screen.

Arguments

  • vec4 color - Background color.

void engine.splash.setWorldImage (Image image, int threshold = 0)

Sets an image for a world splash screen, which is displayed while the world is being loaded. The splash screen is a two-part texture shown according to the threshold.

Arguments

  • Image image - Image to be used as a world splash screen.
  • int threshold - Amount of blur in the alpha channel when interpolating between states of the splash screen. This is an optional parameter; if it is not passed, 0 will be used instead.

void engine.splash.setWorldText (string text)

Sets the text of the world splash screen.

Arguments

  • string text - Text of the world splash screen.

void engine.splash.setWorldTransform (vec4 transform)

Sets transformation of the world splash.

Arguments

  • vec4 transform - Transformation of the world splash.

void engine.splash.setWorld (string name, int threshold = 0)

Sets basic properties of a world splash screen, which is displayed while the world is being loaded. The splash screen is a two-part texture.
Notice
If NULL is set for a splash screen texture, LOADING text will be shown instead.

Arguments

  • string name - Name of the file with the world splash screen. If NULL (0) is passed, the splash screen is cleared.
  • int threshold - Amount of blur in the alpha channel when interpolating between states of the splash screen. This is an optional parameter; if it is not passed, 0 will be used instead.
Last update: 2017-07-03