group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
menu_theme Namespace Reference

Classes

struct  ThemeSettings
struct  ScopedTheme
 Temporarily replace the live menu theme and restore it when leaving scope. More...
struct  ScopedTerminalFont
 RAII helper that pushes terminalFont() for its lifetime. No-op when the font is missing. More...

Functions

ThemeSettingssettings ()
 Mutable live menu theme settings used by applyStyle() and helpers.
const ThemeSettingsterminalSettings ()
 Front-end white terminal menu defaults.
const ThemeSettingsgameplaySettings ()
 In-game bluish menu defaults that match the current HUD palette.
void applyStyle ()
 Apply the cohesive white terminal style (colors + rounding + spacing).
void setSfxSystem (SfxSystem *system)
 Attach the shared SFX system used by menu widgets. Passing nullptr disables UI sounds.
void playUiSound (UiSoundAction action, float gain=1.0f)
 Play a semantic UI sound when an SFX system is attached and initialized.
void loadFonts ()
 Load the UI font (terminal font if present, otherwise SpaceGrotesk) and set it as the default.
ImFont * terminalFont ()
 Pointer to the loaded terminal/CRT font, or nullptr if none was found by loadFonts().
float scaleFor (const ImVec2 &display)
 Responsive UI scale derived from the current display size (1.0 at 1280x720).
bool beginPanel (const char *idAndTitle, float baseWidth, float baseHeight, bool showTitle, ImGuiWindowFlags extraFlags=0)
 Begin a centered, responsive, chromeless panel.
void endPanel ()
 End a panel opened with beginPanel().
bool beginScrollBody (const char *id, float footerHeight)
 Begin a scrollable body region inside a panel that reserves footerHeight pixels at the bottom for sticky action buttons.
void endScrollBody ()
 End a scroll body opened with beginScrollBody().
void heading (const char *text)
 Accent section header with an underline rule (styled replacement for ImGui::SeparatorText).
void terminalSection (const char *text)
 Terminal-style section prompt/header.
bool terminalActionRow (const char *command, const char *description=nullptr, const ImVec2 &size=ImVec2(0, 0), bool danger=false)
 Selectable command row for keyboard/gamepad/mouse-driven terminal menus.
void terminalStatusLine (const char *left, const char *right=nullptr)
 Draw a dim one-line terminal status strip.
bool accentButton (const char *label, const ImVec2 &size=ImVec2(0, 0))
 Bright accent call-to-action button.
bool dangerButton (const char *label, const ImVec2 &size=ImVec2(0, 0))
 Red destructive-action button.
void drawBackground (SDL_GPUDevice *device)
 Draw the gradient + optional bg.webp background behind the current frame.
void buildTweaker (bool *open)
 Live ImGui editor for every shared menu-theme parameter.
void releaseBackground (SDL_GPUDevice *device)
 Release GPU resources held for the background. Call before the GPU device is destroyed.

Variables

constexpr float k_frontendPanelBaseWidth = 900.0f
constexpr float k_frontendPanelBaseHeight = 660.0f

Function Documentation

◆ accentButton()

bool menu_theme::accentButton ( const char * label,
const ImVec2 & size )

Bright accent call-to-action button.

Here is the caller graph for this function:

◆ applyStyle()

void menu_theme::applyStyle ( )

Apply the cohesive white terminal style (colors + rounding + spacing).

Note
Call once after ImGui::CreateContext() (and after ImGui::StyleColorsDark()).
Here is the caller graph for this function:

◆ beginPanel()

bool menu_theme::beginPanel ( const char * idAndTitle,
float baseWidth,
float baseHeight,
bool showTitle,
ImGuiWindowFlags extraFlags = 0 )

Begin a centered, responsive, chromeless panel.

Parameters
idAndTitleWindow id; also drawn as the panel title when showTitle is true.
baseWidthDesign width at 1280x720 (scaled up/down with the display).
baseHeightDesign height at 1280x720.
showTitleWhen true, draws a large accent title + underline rule.
extraFlagsAdditional ImGuiWindowFlags to OR in.
Returns
ImGui::Begin() result. Always pair with endPanel(), even when this returns false.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ beginScrollBody()

bool menu_theme::beginScrollBody ( const char * id,
float footerHeight )

Begin a scrollable body region inside a panel that reserves footerHeight pixels at the bottom for sticky action buttons.

Pair with endScrollBody(); content rendered between the calls scrolls vertically while callers can render footer widgets after endScrollBody().

Parameters
idUnique child id.
footerHeightHeight in pixels to reserve below the scroll body (button rows + spacing).
Returns
True when the child is visible (always pair with endScrollBody regardless).
Here is the caller graph for this function:

◆ buildTweaker()

void menu_theme::buildTweaker ( bool * open)

Live ImGui editor for every shared menu-theme parameter.

Here is the call graph for this function:

◆ dangerButton()

bool menu_theme::dangerButton ( const char * label,
const ImVec2 & size )

Red destructive-action button.

Here is the caller graph for this function:

◆ drawBackground()

void menu_theme::drawBackground ( SDL_GPUDevice * device)

Draw the gradient + optional bg.webp background behind the current frame.

Parameters
deviceGPU device used to upload the background image (may be null; gradient still draws).
Note
Loads the image lazily on first call and silently falls back to the gradient when none is found.
Here is the caller graph for this function:

◆ endPanel()

void menu_theme::endPanel ( )

End a panel opened with beginPanel().

Here is the caller graph for this function:

◆ endScrollBody()

void menu_theme::endScrollBody ( )

End a scroll body opened with beginScrollBody().

Here is the caller graph for this function:

◆ gameplaySettings()

const ThemeSettings & menu_theme::gameplaySettings ( )

In-game bluish menu defaults that match the current HUD palette.

Here is the caller graph for this function:

◆ heading()

void menu_theme::heading ( const char * text)

Accent section header with an underline rule (styled replacement for ImGui::SeparatorText).

◆ loadFonts()

void menu_theme::loadFonts ( )

Load the UI font (terminal font if present, otherwise SpaceGrotesk) and set it as the default.

Safe (no-op) if no font file is found.

Here is the caller graph for this function:

◆ playUiSound()

void menu_theme::playUiSound ( UiSoundAction action,
float gain )

Play a semantic UI sound when an SFX system is attached and initialized.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ releaseBackground()

void menu_theme::releaseBackground ( SDL_GPUDevice * device)

Release GPU resources held for the background. Call before the GPU device is destroyed.

Here is the caller graph for this function:

◆ scaleFor()

float menu_theme::scaleFor ( const ImVec2 & display)

Responsive UI scale derived from the current display size (1.0 at 1280x720).

Here is the caller graph for this function:

◆ setSfxSystem()

void menu_theme::setSfxSystem ( SfxSystem * system)

Attach the shared SFX system used by menu widgets. Passing nullptr disables UI sounds.

Here is the caller graph for this function:

◆ settings()

ThemeSettings & menu_theme::settings ( )

Mutable live menu theme settings used by applyStyle() and helpers.

Here is the caller graph for this function:

◆ terminalActionRow()

bool menu_theme::terminalActionRow ( const char * command,
const char * description,
const ImVec2 & size,
bool danger )

Selectable command row for keyboard/gamepad/mouse-driven terminal menus.

Here is the caller graph for this function:

◆ terminalFont()

ImFont * menu_theme::terminalFont ( )

Pointer to the loaded terminal/CRT font, or nullptr if none was found by loadFonts().

◆ terminalSection()

void menu_theme::terminalSection ( const char * text)

Terminal-style section prompt/header.

Here is the caller graph for this function:

◆ terminalSettings()

const ThemeSettings & menu_theme::terminalSettings ( )

Front-end white terminal menu defaults.

◆ terminalStatusLine()

void menu_theme::terminalStatusLine ( const char * left,
const char * right )

Draw a dim one-line terminal status strip.

Here is the caller graph for this function:

Variable Documentation

◆ k_frontendPanelBaseHeight

float menu_theme::k_frontendPanelBaseHeight = 660.0f
inlineconstexpr

◆ k_frontendPanelBaseWidth

float menu_theme::k_frontendPanelBaseWidth = 900.0f
inlineconstexpr