Jazz2::IRootController class

Base interface of a root controller.

Top-level application controller that owns the active state handler and drives transitions between them (main menu, levels), manages resumable state, exposes async invocation, and on supported builds connects to or hosts a multiplayer server.

Public types

enum class Flags { None = 0x00, IsInitialized = 0x01, IsVerified = 0x02, IsPlayable = 0x04 }
State flags of root controller, supports a bitwise combination of its member values.

Constructors, destructors, conversion operators

IRootController()
Creates a new instance.
~IRootController() virtual
IRootController(const IRootController&) deleted

Public functions

auto operator=(const IRootController&) -> IRootController& deleted
void InvokeAsync(Function<void()>&& callback) pure virtual
Invokes the specified callback asynchronously, usually at the end of current frame.
void InvokeAsync(std::weak_ptr<void> reference, Function<void()>&& callback) pure virtual
void GoToMainMenu(bool afterIntro) pure virtual
Sets current state handler to main menu.
void ChangeLevel(LevelInitialization&& levelInit) pure virtual
Sets current state handler to level described by LevelInitialization.
auto HasResumableState() const -> bool pure virtual
Returns true if any resumable state exists.
void ResumeSavedState() pure virtual
Resumes saved resumable state.
auto SaveCurrentStateIfAny() -> bool pure virtual
Saves current state if it's resumable.
auto GetFlags() const -> Flags pure virtual
Returns current state flags.
auto GetNewestVersion() const -> StringView pure virtual
Returns version of the latest update.
auto GetInitializationProgress() const -> float pure virtual
Returns progress of the initialization in the range 0-1, or -1 if there is nothing to show.
void RefreshCacheLevels(bool recreateAll, Compatibility::ConversionProgress progress = {}) pure virtual
Recreates level cache from Source directory.

Enum documentation

enum class Jazz2::IRootController::Flags

State flags of root controller, supports a bitwise combination of its member values.

Enumerators
None

None

IsInitialized

The controller has been initialized

IsVerified

The assets have been verified

IsPlayable

The game is playable

Function documentation

void Jazz2::IRootController::InvokeAsync(std::weak_ptr<void> reference, Function<void()>&& callback) pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

float Jazz2::IRootController::GetInitializationProgress() const pure virtual

Returns progress of the initialization in the range 0-1, or -1 if there is nothing to show.

Converting the original game files is the one part of the first start that can take long enough to be worth showing, so the loading screen turns this into a progress bar. It's -1 whenever no conversion is running — including before one has reported anything at all, so a loading screen that is shown for some other reason never shows a bar.

void Jazz2::IRootController::RefreshCacheLevels(bool recreateAll, Compatibility::ConversionProgress progress = {}) pure virtual

Recreates level cache from Source directory.

Parameters
recreateAll
progress Reports how far the conversion has got, see ConversionProgress