Jazz2::UI::Menu::LevelPacksSection class

Level packs menu section.

Shows the installed level packs as a grid of tiles with a preview each, several of them in a row if the screen is wide enough. A pack is opened in LevelPackDetailSection.

Base classes

class MenuSection
Base class of a menu section.

Public static functions

static auto LoadPreview(const LevelPacks::LevelPackManifest& pack, Vector2i& size) -> std::unique_ptr<Texture>
Makes the preview of a pack, its own picture or the preview of its first level, nullptr if it has none.
static auto FitText(IMenuContainer* root, StringView text, float scale, float maxWidth) -> String
Returns text shortened to fit maxWidth when drawn at scale.

Constructors, destructors, conversion operators

LevelPacksSection(EpisodeSelectMode mode = EpisodeSelectMode::Singleplayer, bool privateServer = false)
Creates a new instance.

Public functions

auto GetClipRectangle(const Recti& contentBounds) -> Recti override
Allows to override clip rectangle of the middle layer.
void OnShow(IMenuContainer* root) override
Called when the section is shown.
void OnUpdate(float timeMult) override
Called when the section should be updated.
void OnDraw(Canvas* canvas) override
Called when the section should be drawn — the bottom background layer.
void OnDrawClipped(Canvas* canvas) override
Called when the section should be drawn — the middle clipped layer.
void OnTouchEvent(const TouchEvent& event, Vector2i viewSize) override
Called when a touch event is triggered.

Function documentation

Jazz2::UI::Menu::LevelPacksSection::LevelPacksSection(EpisodeSelectMode mode = EpisodeSelectMode::Singleplayer, bool privateServer = false)

Creates a new instance.

Parameters
mode How a level of a pack is started
privateServer Whether a hosted online server should be private