coastline 0.0.4
Loading...
Searching...
No Matches
coastline::Menus Class Reference

The menus, drawn with the import of a release. More...

#include <menus.h>

Public Member Functions

 ~Menus ()
 Release front-end resources before the configuration and renderer are destroyed.
 Menus (const Menus &)=delete
 Prevent copying active front-end resources and screen progress.
Menus & operator= (const Menus &)=delete
 Prevent assignment of active front-end resources and screen progress.
void Restart ()
 Show the main menu again, as the splash screens and the attract demo switch to it.
bool IsMainMenu () const
MenusEnd Frame (SceneRenderer &renderer, float seconds, const std::array< MenuButtons, 2 > &players, bool secondController, const PaintShopInput &pointer)
 Run a frame of the screen that shows and draw it.
bool DrawsPointer () const
bool TakesText () const
int ControlledPlayers () const
RaceSetup ChosenRace () const
std::optional< std::filesystem::path > CarImages (int car) const
void FinishRace (RaceEnd end, const RaceResults &results, bool sfxVolumeAdjusted=false)
 Go on from a race that Frame() started, as FinishRace() of the console goes on: to the results screen, to the next season of the championship, or to the main menu.
void FinishCredits ()
 Show the options menu again after the race of the credits it started.
void SetMenuMusic (std::function< void()> play)
 Set the routine that starts the music module of the menus, which the main menu calls as it opens after a module of fewer channels, the module of a race.
void SetOptionOverrides (GameConfig overrides)
 Display temporary command-line values and disable matching Options entries.

Static Public Member Functions

static std::unique_ptr< Menus > Load (SceneRenderer &renderer, const std::filesystem::path &release, const std::filesystem::path &saves, const std::filesystem::path &cache, GameConfig &config, const std::filesystem::path &configPath, ConfigSaver &configSaver, std::span< const std::filesystem::path > dataRoots={}, std::string_view assetPack={}, std::string_view unitsRegion={}, const nlohmann::json &packSettings=nlohmann::json::object())
 Read the assets of the menu screens and the items of each screen.

Detailed Description

The menus, drawn with the import of a release.

Constructor & Destructor Documentation

◆ ~Menus()

coastline::Menus::~Menus ( )

Release front-end resources before the configuration and renderer are destroyed.

◆ Menus()

coastline::Menus::Menus ( const Menus & )
delete

Prevent copying active front-end resources and screen progress.

Member Function Documentation

◆ Load()

std::unique_ptr< Menus > coastline::Menus::Load ( SceneRenderer & renderer,
const std::filesystem::path & release,
const std::filesystem::path & saves,
const std::filesystem::path & cache,
GameConfig & config,
const std::filesystem::path & configPath,
ConfigSaver & configSaver,
std::span< const std::filesystem::path > dataRoots = {},
std::string_view assetPack = {},
std::string_view unitsRegion = {},
const nlohmann::json & packSettings = nlohmann::json::object() )
static

Read the assets of the menu screens and the items of each screen.

Parameters
rendererThe renderer that draws them.
releaseThe selected cartridge directory, n64/base of the prepared assets.
savesThe directory of the saves, the data directory of the game, with the Controller Pak and the frames of the ghost car.
cacheThe cache directory of the game, for the images of the painted cars.
configThe settings of BossRally.ini, with the cars the players chose last. The settings outlive the menus.
configPathThe file of the settings, written whenever a player chooses a car.
configSaverThe thread that writes the settings. The thread outlives the menus.
dataRootsThe imported data roots for available packs and cartridge regions.
assetPackThe active pack, or empty to use the configured pack.
unitsRegionThe explicit CLI region for automatic units, or empty to use locale.
packSettingsAsset-pack menu heading, idle timeout, and attract-demo preferences.
Returns
The menus, or nothing with the reason logged.

◆ operator=()

Menus & coastline::Menus::operator= ( const Menus & )
delete

Prevent assignment of active front-end resources and screen progress.

◆ Restart()

void coastline::Menus::Restart ( )

Show the main menu again, as the splash screens and the attract demo switch to it.

◆ IsMainMenu()

bool coastline::Menus::IsMainMenu ( ) const
inline
Returns
Whether the root main menu is active.

◆ Frame()

MenusEnd coastline::Menus::Frame ( SceneRenderer & renderer,
float seconds,
const std::array< MenuButtons, 2 > & players,
bool secondController,
const PaintShopInput & pointer )

Run a frame of the screen that shows and draw it.

Parameters
rendererThe renderer of the frame, between Begin() and End().
secondsThe time of the frame.
playersThe presses of the first and the second controller.
secondControllerWhether a device is bound to the second port.
pointerThe buttons, the stick, and the mouse of the first player, as the paint shop and the dialogs of the Controller Pak read them.
Returns
Where the menus go.

◆ DrawsPointer()

bool coastline::Menus::DrawsPointer ( ) const
Returns
Whether the screen that shows draws a cursor for the mouse.

◆ TakesText()

bool coastline::Menus::TakesText ( ) const
Returns
Whether the screen that shows takes the text typed on a keyboard.

◆ ControlledPlayers()

int coastline::Menus::ControlledPlayers ( ) const
Returns
The number of players the screen that shows reads, 2 on the car select of two.

◆ ChosenRace()

RaceSetup coastline::Menus::ChosenRace ( ) const
Returns
The race the menus chose, in the terms of the race engine.

◆ CarImages()

std::optional< std::filesystem::path > coastline::Menus::CarImages ( int car) const
Parameters
carThe race-engine car index.
Returns
The car's preview-document path for the selected region and asset pack, or an empty optional when the car is unavailable.

◆ FinishRace()

void coastline::Menus::FinishRace ( RaceEnd end,
const RaceResults & results,
bool sfxVolumeAdjusted = false )

Go on from a race that Frame() started, as FinishRace() of the console goes on: to the results screen, to the next season of the championship, or to the main menu.

Parameters
endHow the race ended.
resultsThe results of the race, read when it ended with RaceEnd::Results.
sfxVolumeAdjustedWhether the pause menu changed SFX volume during the race, even if later restored to its initial level.

◆ FinishCredits()

void coastline::Menus::FinishCredits ( )

Show the options menu again after the race of the credits it started.

◆ SetMenuMusic()

void coastline::Menus::SetMenuMusic ( std::function< void()> play)
inline

Set the routine that starts the music module of the menus, which the main menu calls as it opens after a module of fewer channels, the module of a race.

Parameters
playThe routine, or empty for none.

◆ SetOptionOverrides()

void coastline::Menus::SetOptionOverrides ( GameConfig overrides)
inline

Display temporary command-line values and disable matching Options entries.

Parameters
overridesPer-run settings that are never written to the user's INI file.

The documentation for this class was generated from the following file: