Jazz2::UI::LoadingHandler class

Handler that only shows the loading indicator.

State handler for the loading screen shown while content is being prepared, drawing an animated loading indicator over a light or dark background. An optional callback is invoked once loading completes.

A conversion of the original game files that is still running is shown as a progress bar as well, because on a slow device it can take long enough that an indicator alone says too little — see IRootController::GetInitializationProgress().

Loading that is still going after a minute is treated as a long wait: a light background turns dark and an aura of slowly drifting color blobs fades in behind the indicator. The aura is made only of textured quads with alpha blending, so it renders the same on every backend, the fixed-function ones included.

Base classes

class Jazz2::IStateHandler
Base interface of a state handler, only one handler runs at a time.

Constructors, destructors, conversion operators

LoadingHandler(IRootController* root, bool darkMode)
Creates a new instance.
LoadingHandler(IRootController* root, bool darkMode, Function<bool(IRootController*)>&& callback)
Creates a new instance with a completion callback.
~LoadingHandler() override

Public functions

auto GetViewSize() const -> Vector2i override
Returns viewport size of the handler.
void OnBeginFrame() override
Called at the beginning of each frame.
void OnInitializeViewport(std::int32_t width, std::int32_t height) override
Called when the viewport needs to be initialized (e.g., when the resolution is changed).

Constants

static std::int32_t DefaultWidth constexpr
Default width of viewport (see Rendering::UpscaleRenderPass::DefaultViewWidth).
static std::int32_t DefaultHeight constexpr
Default height of viewport.

Function documentation

Jazz2::UI::LoadingHandler::LoadingHandler(IRootController* root, bool darkMode)

Creates a new instance.

Parameters
root Root controller
darkMode Whether to start with the dark theme, the light one turns dark during a long wait

Jazz2::UI::LoadingHandler::LoadingHandler(IRootController* root, bool darkMode, Function<bool(IRootController*)>&& callback)

Creates a new instance with a completion callback.

Parameters
root Root controller
darkMode Whether to start with the dark theme, the light one turns dark during a long wait
callback Called when the loading finishes