Overlay architecture, HUD system, and popup management in osu!
The UI overlay system in osu! manages all popup interfaces, settings panels, notifications, and heads-up displays. It provides a consistent and extensible framework for displaying UI elements on top of game screens.
Base class for large, feature-rich overlays.Location: osu.Game/Overlays/FullscreenOverlay.cs:19
public abstract partial class FullscreenOverlay<T> : WaveOverlayContainer, INamedOverlayComponent where T : OverlayHeader{ // Icon, title, and description for toolbar public virtual IconUsage Icon { get; } public virtual LocalisableString Title { get; } public virtual LocalisableString Description { get; } // Header component public T Header { get; private set; } // Color scheme protected readonly OverlayColourProvider ColourProvider; protected virtual Color4 BackgroundColour => ColourProvider.Background5; protected abstract T CreateHeader();}
Dimensions:
Width: 85% of screen
Centered horizontally
Full height
Shadow radius: 10px
FullscreenOverlay uses an OverlayColourProvider to maintain consistent theming across all overlay components.
The main settings panel for the game.Location: osu.Game/Overlays/SettingsOverlay.cs:25
public partial class SettingsOverlay : SettingsPanel, INamedOverlayComponent{ protected override IEnumerable<SettingsSection> CreateSections() { return new List<SettingsSection> { new GeneralSection(), new SkinSection(), new InputSection(createSubPanel(new KeyBindingPanel())), new UserInterfaceSection(), new GameplaySection(), new RulesetSection(), new AudioSection(), new GraphicsSection(), new OnlineSection(), new MaintenanceSection(), new DebugSection() }; }}
Features:
Sidebar navigation
Search functionality
Sub-panels (e.g., key binding editor)
Scrollable sections
Revert to default buttons
SettingsOverlay uses a SettingsSectionsContainer that automatically generates a sidebar from the sections and handles scrolling to specific settings.
Displays popup notifications in the bottom-right corner.
public partial class NotificationOverlay : OsuFocusedOverlayContainer{ // Post a new notification public void Post(Notification notification); // Clear all notifications public void Clear();}
Notification Types:
SimpleNotification: Basic text notification
ProgressNotification: Shows progress bar
ProgressCompletionNotification: Success/failure result
public partial class DialogOverlay : OsuFocusedOverlayContainer, IDialogOverlay{ // Show a dialog public void Push(PopupDialog dialog); // Get current dialog public PopupDialog CurrentDialog { get; }}
public partial class MusicController : Container{ // Current track public IBindable<WorkingBeatmap> CurrentTrack { get; } // Playback control public void Play(); public void Pause(); public void Next(); public void Previous(); // Track position public void SeekTo(double position);}
public interface IOverlayManager{ // Get overlay instance IBindable<OverlayActivation> OverlayActivationMode { get; } // Show/hide overlays void ShowOverlay<T>() where T : IOverlay; void HideOverlay<T>() where T : IOverlay; // Toggle overlay void ToggleOverlay<T>() where T : IOverlay;}
public enum OverlayActivation{ All, // All overlays can be shown UserTriggered, // Only user-triggered overlays Disabled // No overlays allowed (e.g., during gameplay)}
During gameplay, overlay activation is set to UserTriggered to prevent automatic popups from interrupting play. Only explicitly triggered overlays (pause menu, etc.) are shown.