group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
MenuTheme.hpp File Reference

Shared visual theme + helpers for the front-end ImGui menus (home/host/lobby/pause). More...

#include "sfx/SfxTypes.hpp"
#include <imgui.h>
Include dependency graph for MenuTheme.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Namespaces

namespace  menu_theme

Functions

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

Variables

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

Detailed Description

Shared visual theme + helpers for the front-end ImGui menus (home/host/lobby/pause).

All front-end menus share one cohesive white terminal look. Call applyStyle() and loadFonts() once after ImGui::CreateContext(); call drawBackground() each frame from a menu screen (after ImGui::NewFrame()) to paint the responsive backdrop.