MenuBuddy
A complete MonoGame library for building menu systems and managing game state transitions. Based on the NetworkStateManagement samples from the golden age of XNA.
Features
- Screen-based architecture – Stack-based screen management with automatic transitions
- Multiple input modes – Support for controller, mouse, and touch input
- Rich widget library – Labels, buttons, sliders, dropdowns, text input, checkboxes, and more
- Flexible layouts – Absolute, relative, stack, scroll, padded, and tree layouts
- Customizable styling – Global stylesheet for consistent appearance across your UI
- Smooth transitions – Built-in fade, slide, and wipe transitions between screens
- Multi-platform – Works on DesktopGL, iOS, Android, and Windows Universal
Quick Install
dotnet add package MenuBuddy
Minimal Example
using MenuBuddy;
using Microsoft.Xna.Framework;
public class MyGame : MouseGame
{
public MyGame()
{
VirtualResolution = new Point(1280, 720);
ScreenResolution = new Point(1280, 720);
}
public override IScreen[] GetMainMenuScreenStack()
{
return new IScreen[] { new MainMenuScreen() };
}
}
public class MainMenuScreen : MenuStackScreen
{
public MainMenuScreen() : base("Main Menu") { }
public override async Task LoadContent()
{
await base.LoadContent();
var startButton = new MenuEntry("Start Game", Content);
startButton.OnClick += (sender, e) =>
{
ScreenManager.AddScreen(new GameplayScreen());
};
AddMenuEntry(startButton);
}
}
Documentation
| Page | Description |
|---|---|
| Getting Started | Installation, setup, and your first menu |
| Architecture | High-level design and class relationships |
| Screens | Screen types, lifecycle, and management |
| Widgets | Labels, buttons, sliders, dropdowns, and more |
| Layouts | Absolute, stack, relative, scroll, padded, and tree layouts |
| Styling | Global theming with the StyleSheet class |
| Transitions | Screen transition effects and animation |
| Input | Controller, mouse, and touch input handling |
| API Reference | Complete interface and class reference |
Dependencies
MenuBuddy depends on several companion libraries, all installed automatically via NuGet:
- FontBuddy – Font rendering
- InputHelper – Input state management
- ResolutionBuddy – Resolution management
- PrimitiveBuddy – Primitive rendering
- GameTimer – Timing utilities
- HadoukInput – Controller input
- MouseBuddy – Mouse input
- TouchScreenBuddy – Touch input
- MatrixExtensions – Matrix utilities
- Vector2Extensions – Vector utilities
Sample Project
For a complete working example, see MenuBuddySample.
License
MIT License – see LICENSE for details.