The coopdx-rs launcher renders everything through SDL2 — there is no native widget toolkit. All UI elements are drawn each frame using textured quads, software-rasterised rounded rectangles, and pre-rendered TTF glyphs cached as SDL2 textures. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/retired64/sm64coopdx_launcher/llms.txt
Use this file to discover all available pages before exploring further.
src/ui/ directory contains nine modules that together form the complete UI layer.
UI module overview
common
Shared types and rendering helpers:
UiItem, ItemType, draw_item_selector, ensure_selection_visible. Used by every sub-screen that renders a scrollable item list.menu
Arc menu with 5 items arranged in a curved panel on the right side of the screen: Mod Manager, DynOS Packs, Network, Download Mods, Settings. Hit-testing and animation state live here.
panel
PanelState — the sliding side panel that hosts all sub-screens. Handles smooth slide_x animation, rounded-corner background rendering, header/footer caching, and SubScreenType dispatch.splash
SplashState — 7-phase loading progress bar shown during startup asset loading. Manages fade-in, progress animation, and the transition signal to the main game screen.vinyl
Animated spinning vinyl disc rendered in the bottom-right corner of the main screen. Rotates at
VINYL_ROT_SPEED = 90°/s and dims when a sub-screen is open.logo
Game logo rendering with a drop shadow offset (
SHADOW_OFFSET = 8px). The logo is scaled to fit within MAX_LOGO_W × MAX_LOGO_H = 900 × 450 pixels while preserving aspect ratio.keyboard
VirtualKeyboard — on-screen keyboard overlay for text input in SDL2. Used whenever a text field is activated (network fields, profile names). Characters are appended to a caller-supplied buffer.network_form
NetworkFormState — renders the network configuration form. Shows different fields depending on the active NetworkMode: no extra fields for Local, IP+port for Client, port for Server, password for CoopNet.download_browser
DownloadBrowserState, DlFocusMode — the full download browser UI including search bar, tag chips, author dropdown, paginated mod list, and download progress overlay.SubScreenType enum
The panel system routes keyboard input and rendering to the correct sub-screen using theSubScreenType enum defined in src/ui/panel.rs:
| Variant | Header Label |
|---|---|
ModManager | MOD MANAGER |
DynosPacks | DYNOS PACKS |
Network | NETWORK |
DownloadBrowser | DOWNLOAD MODS |
Profiles | PROFILES |
ProfileDetail | PROFILE |
subscreen_for_menu_index(idx: usize) -> Option<SubScreenType>. Indices 0–4 map to ModManager, DynosPacks, Network, DownloadBrowser, and Profiles respectively.
Panel system
PanelState in src/ui/panel.rs drives all sub-screens. It maintains a continuous slide_x value that eases toward either a visible or a hidden target_x position, giving the panel a smooth slide-in/slide-out animation.
| Constant | Value | Meaning |
|---|---|---|
PANEL_W_RATIO | 0.62 | Panel width as a fraction of window width |
PANEL_H_RATIO | 0.72 | Panel height as a fraction of window height |
SLIDE_SPEED | 8.0 | Exponential easing multiplier per second |
HEADER_H | 48 px | Height of the header band |
FOOTER_H | 36 px | Height of the footer hint band |
CORNER_RADIUS | 16 px | Rounded corner radius |
Rounded corners
The panel background is rendered without any native rounded-rectangle primitive (no SDL2_gfx dependency). Instead,make_rounded_bg pre-renders an ARGB8888 surface, fills it with PANEL_BG (rgba(10, 5, 30, 230)), and sets corner pixels outside the radius to fully transparent using a midpoint-circle test. The resulting texture is cached in PanelState and only regenerated on window resize.
Opening and closing
open sets active and moves target_x to the panel’s centred visible position. close moves target_x to win_w (fully off-screen). update advances slide_x each frame using the formula slide_x += (target_x - slide_x) * (SLIDE_SPEED * dt).min(1.0), and clears active once the panel is fully hidden.
The panel body area (below the header, above the footer) is computed by panel_body_rect(win_w, win_h, slide_x) -> Rect. Sub-screens use this rect as their drawing region.
Arc menu
The arc menu insrc/ui/menu.rs presents five buttons in a curved layout on the right side of the screen. Buttons are offset horizontally according to their distance from the centre item, creating the characteristic arc shape.
hit_test_menu_button(mouse_x, mouse_y, win_w, win_h) -> Option<usize>. The highlight_y float tracks the animated highlight bar position, which eases to the selected button’s Y coordinate each frame.
Virtual keyboard
In an SDL2 application there is no platform text-input widget, so the launcher ships its own on-screen keyboard insrc/ui/keyboard.rs. The VirtualKeyboard is used whenever a text field is activated — network form fields (IP address, ports, CoopNet password) and profile name operations (create, rename, player name edit).
buffer. A second Enter on the confirmation key (typically OK / ↵) returns true from confirm_if_active, signalling the caller to commit the edit.
UiItem and ItemType
The generic item selector used by Mod Manager, DynOS Packs, Profiles, and Profile Detail is built on two types fromsrc/ui/common.rs:
draw_item_selector renders a scrollable list of these items inside a panel body rectangle. It accepts pre-rendered SDL2 textures for both item names and the three icon variants (check ✓, dash —, plus +) and performs zero allocations per frame.
Key layout constants from src/ui/common.rs:
| Constant | Value | Meaning |
|---|---|---|
DEFAULT_VISIBLE_ROWS | 9 | Visible rows in standard item lists |
DL_VISIBLE_ROWS | 6 | Visible rows in the download browser mod list |
ensure_selection_visible(selected, scroll, visible_rows) -> usize, which adjusts the scroll offset just enough to keep the selected row on screen (no over-scroll).
Toggle items
Used for mods, DynOS packs, and most profile settings. The
enabled flag drives the icon: ✓ when enabled, — when disabled. Pressing Enter or Space flips enabled and immediately calls the appropriate manager write function.Text items
Used for the Player Name field in Profile Detail. Displays the current
value string next to the label. Pressing Enter opens the VirtualKeyboard with value pre-populated in the buffer.Download browser
DownloadBrowserState in src/ui/download_browser.rs is the most complex UI component. It combines a real-time search bar, tag chip filters, an author dropdown with autocomplete, a paginated mod list, and a download progress overlay.
Focus modes
Key state fields
filter_mods_combined from the download manager.
Download progress overlay
While a download is in progress the browser renders a progress bar overlay on top of the mod list. The overlay readsDownloadProgress from the shared Arc<Mutex<DownloadProgress>> and displays bytes downloaded, percentage, and — after extraction — the number of mods extracted.