|
coastline 0.0.4
|
The state and the assets of the menu screens, read once from the import of a release. More...
#include <menuscreen.h>

Public Member Functions | |
| ~MenuScreen () | |
| Release shared menu models, textures, and sounds before the renderer and mixer contexts. | |
| MenuScreen (const MenuScreen &)=delete | |
| Prevent copying shared menu rendering and audio resources. | |
| MenuScreen & | operator= (const MenuScreen &)=delete |
| Prevent assignment of shared menu rendering and audio resources. | |
| std::optional< std::vector< MenuItem > > | LoadItems (SceneRenderer &renderer, const std::filesystem::path &directory, std::span< const char *const > stems) |
| Read the items of a directory of the import, as LoadMenuItemModels() of the console. | |
| const RenderModel * | LoadModel (SceneRenderer &renderer, const std::filesystem::path &path) |
| Read a model for an item, shared with every other item of the same file. | |
| void | Reset () |
| ResetAndInitDisplay() of the console: clear the idle timeout and the hooks of the screen before another starts. | |
| bool | TimedOut () const |
| MenuResult | Process (SceneRenderer &renderer, float seconds, std::span< const MenuButtons > players, const MenuSetup &setup) |
| Run a frame of a screen and draw it, as ProcessScreenState() of the console. | |
| void | SetPendingSelection (int item) |
| SetScreenPendingSelection() of the console: move the cursor to an item on the next frame. | |
| int | LastActiveIndex () const |
| void | SetLastActiveIndex (int item) |
| Set the item under the cursor on the last frame, as a screen does before it starts. | |
| int | ChoosingPlayer () const |
| const RenderTexture & | MainMenuTitle () const |
| const RenderTexture & | TitleBar () const |
| const MenuText & | Text () const |
| const Lighting & | MenuLighting () const |
| void | DrawBackground (SceneRenderer &renderer, const std::array< int, 3 > &top, const std::array< int, 3 > &bottom) const |
| Draw the background of a screen, its texels lerping from one colour to another. | |
| void | DrawFooter (SceneRenderer &renderer) const |
| DrawMenuFooterButtons() of the console: the buttons at the bottom and their names. | |
| void | DrawPauseFooter (SceneRenderer &renderer) const |
| DrawPauseMenuButtons() of the console: the buttons at the bottom to go on and to exit. | |
| void | PlayScrollSound () |
| Play the sound of moving the cursor. | |
| void | PlaySelectSound () |
| Play the sound of choosing. | |
| void | FadeIn (bool fadeMusic=true, bool fadeSounds=true) |
| Start the fade of a screen that draws itself in, as SetFadeTarget() and FadeSfxTo() of the console fade it in from black. | |
| void | FadeOut () |
| Fade the screen and the sound effects out. | |
| void | FadeSounds (float level) |
| Fade the sound effects and the music alone, as FadeSfxTo() and FadeMusicTo() of the console. | |
| bool | SoundsFaded () const |
| void | UpdateFade (float seconds) |
| Advance the fades of the screen and the sound effects by a frame. | |
| bool | FadingOut () const |
| bool | FadeComplete () const |
| void | DrawFade (SceneRenderer &renderer) const |
| Draw the black of the fade, as ApplyScreenFade() of the console. | |
Static Public Member Functions | |
| static void | DrawCoin (SceneRenderer &renderer, float x, float angle, const Matrix4 &projection, bool locked=false) |
| Draw the lit coin and its shadow on the menu stage. | |
| static std::unique_ptr< MenuScreen > | Load (SceneRenderer &renderer, const std::filesystem::path &release) |
| Read the background, the arrows, the title pictures, the fonts, the lights, the choice marker, and the sounds the screens share. | |
| static void | DrawTexture (SceneRenderer &renderer, const RenderTexture &texture, int x, int y, int width, int height) |
| Draw a texture stretched over a rectangle of the 320 by 240 screen, as DrawTexturedRect() of the console, its texels as they are. | |
| static void | DrawFadeOverlay (SceneRenderer &renderer, float level, int x, int y, int width, int height) |
| DrawScreenFadeOverlay() of the console under a scissor: darken a rectangle of the 320 by 240 screen. | |
| static Matrix4 | FlatFor (SceneRenderer &renderer) |
| static void | SilenceSounds () |
| Silence every channel of the sound effects, as a screen does once it has faded out. | |
Public Attributes | |
| std::optional< MenuTitleImage > | titleImage |
| float | idleTimeout = 0.0f |
| std::function< void(SceneRenderer &, int)> | postDraw |
| The draw after the item under the cursor, with that item, g_pfnScreenPostDrawCallback. | |
| std::function< void(SceneRenderer &)> | preDraw |
| The draw in place of the stage and the items, g_pfnScreenPreDrawCallback. | |
The state and the assets of the menu screens, read once from the import of a release.
| coastline::MenuScreen::~MenuScreen | ( | ) |
Release shared menu models, textures, and sounds before the renderer and mixer contexts.
|
delete |
Prevent copying shared menu rendering and audio resources.
|
static |
Draw the lit coin and its shadow on the menu stage.
| renderer | The renderer recording the current frame. |
| x | The horizontal stage position. |
| angle | The coin rotation, in radians. |
| projection | The stage-to-frame projection matrix. |
| locked | Whether to draw a dim grey coin instead of gold. |
|
static |
Read the background, the arrows, the title pictures, the fonts, the lights, the choice marker, and the sounds the screens share.
| renderer | The renderer that draws the screens. |
| release | The selected cartridge directory, n64/base of the prepared assets. |
|
delete |
Prevent assignment of shared menu rendering and audio resources.
| std::optional< std::vector< MenuItem > > coastline::MenuScreen::LoadItems | ( | SceneRenderer & | renderer, |
| const std::filesystem::path & | directory, | ||
| std::span< const char *const > | stems ) |
Read the items of a directory of the import, as LoadMenuItemModels() of the console.
Items whose model is the same file share it.
| renderer | The renderer that draws the models. |
| directory | The directory, with items.json and a glTF file for each item. |
| stems | The names of the items in items.json, in the order of the screen. |
| const RenderModel * coastline::MenuScreen::LoadModel | ( | SceneRenderer & | renderer, |
| const std::filesystem::path & | path ) |
Read a model for an item, shared with every other item of the same file.
| renderer | The renderer that draws the model. |
| path | The glTF file. |
| void coastline::MenuScreen::Reset | ( | ) |
ResetAndInitDisplay() of the console: clear the idle timeout and the hooks of the screen before another starts.
The title picture is not cleared.
| bool coastline::MenuScreen::TimedOut | ( | ) | const |
| MenuResult coastline::MenuScreen::Process | ( | SceneRenderer & | renderer, |
| float | seconds, | ||
| std::span< const MenuButtons > | players, | ||
| const MenuSetup & | setup ) |
Run a frame of a screen and draw it, as ProcessScreenState() of the console.
| renderer | The renderer of the frame, between Begin() and End(). |
| seconds | The time of the frame. |
| players | The presses of each local player, from the first. |
| setup | What the screen shows. |
| void coastline::MenuScreen::SetPendingSelection | ( | int | item | ) |
SetScreenPendingSelection() of the console: move the cursor to an item on the next frame.
| item | The item. |
| int coastline::MenuScreen::LastActiveIndex | ( | ) | const |
| void coastline::MenuScreen::SetLastActiveIndex | ( | int | item | ) |
Set the item under the cursor on the last frame, as a screen does before it starts.
| item | The item. |
| int coastline::MenuScreen::ChoosingPlayer | ( | ) | const |
| const RenderTexture & coastline::MenuScreen::MainMenuTitle | ( | ) | const |
| const RenderTexture & coastline::MenuScreen::TitleBar | ( | ) | const |
| const MenuText & coastline::MenuScreen::Text | ( | ) | const |
| const Lighting & coastline::MenuScreen::MenuLighting | ( | ) | const |
|
static |
Draw a texture stretched over a rectangle of the 320 by 240 screen, as DrawTexturedRect() of the console, its texels as they are.
| renderer | The renderer of the frame. |
| texture | The texture. |
| x | The left. |
| y | The top. |
| width | The width. |
| height | The height. |
|
static |
DrawScreenFadeOverlay() of the console under a scissor: darken a rectangle of the 320 by 240 screen.
| renderer | The renderer of the frame. |
| level | The level of the picture shown, from 0 for black to 1 for the picture as it is. |
| x | The left. |
| y | The top. |
| width | The width. |
| height | The height. |
|
static |
| renderer | The renderer of the frame. |
| void coastline::MenuScreen::DrawBackground | ( | SceneRenderer & | renderer, |
| const std::array< int, 3 > & | top, | ||
| const std::array< int, 3 > & | bottom ) const |
Draw the background of a screen, its texels lerping from one colour to another.
| renderer | The renderer of the frame. |
| top | The red, green, and blue of the dark background. |
| bottom | The colour the texels of the background lerp to. |
| void coastline::MenuScreen::DrawFooter | ( | SceneRenderer & | renderer | ) | const |
DrawMenuFooterButtons() of the console: the buttons at the bottom and their names.
| renderer | The renderer of the frame. |
| void coastline::MenuScreen::DrawPauseFooter | ( | SceneRenderer & | renderer | ) | const |
DrawPauseMenuButtons() of the console: the buttons at the bottom to go on and to exit.
| renderer | The renderer of the frame. |
| void coastline::MenuScreen::PlayScrollSound | ( | ) |
Play the sound of moving the cursor.
| void coastline::MenuScreen::PlaySelectSound | ( | ) |
Play the sound of choosing.
| void coastline::MenuScreen::FadeIn | ( | bool | fadeMusic = true, |
| bool | fadeSounds = true ) |
Start the fade of a screen that draws itself in, as SetFadeTarget() and FadeSfxTo() of the console fade it in from black.
| fadeMusic | Whether the music fades in as well, or stays at its level. |
| fadeSounds | Whether the sound effects fade in as well, or stay at their level. |
| void coastline::MenuScreen::FadeOut | ( | ) |
Fade the screen and the sound effects out.
| void coastline::MenuScreen::FadeSounds | ( | float | level | ) |
Fade the sound effects and the music alone, as FadeSfxTo() and FadeMusicTo() of the console.
| level | The level to fade to, from 0 for silence to 1. |
| bool coastline::MenuScreen::SoundsFaded | ( | ) | const |
| void coastline::MenuScreen::UpdateFade | ( | float | seconds | ) |
Advance the fades of the screen and the sound effects by a frame.
| seconds | The time of the frame. |
| bool coastline::MenuScreen::FadingOut | ( | ) | const |
| bool coastline::MenuScreen::FadeComplete | ( | ) | const |
| void coastline::MenuScreen::DrawFade | ( | SceneRenderer & | renderer | ) | const |
Draw the black of the fade, as ApplyScreenFade() of the console.
| renderer | The renderer of the frame. |
|
static |
Silence every channel of the sound effects, as a screen does once it has faded out.
| std::optional<MenuTitleImage> coastline::MenuScreen::titleImage |
The picture over the title, g_pMenuTitleImage.
| float coastline::MenuScreen::idleTimeout = 0.0f |
The time without input after which the screen exits, or 0.
| std::function<void(SceneRenderer &, int)> coastline::MenuScreen::postDraw |
The draw after the item under the cursor, with that item, g_pfnScreenPostDrawCallback.
| std::function<void(SceneRenderer &)> coastline::MenuScreen::preDraw |
The draw in place of the stage and the items, g_pfnScreenPreDrawCallback.