monogame-ui-core
Installation
SKILL.md
MonoGame UI Core — Architecture Guide
This skill establishes the foundational architecture for a MonoGame UI system. For layout engines, see monogame-ui-layout. For click/hover handling, see monogame-ui-interaction. For gamepad/keyboard focus, see monogame-ui-focus. For ready-made components, see monogame-ui-controls.
For complete code templates, read references/ui-core.md.
The Golden Rule
UI is not a game entity. Never mix UI elements into your ECS, physics system, or world-space scene graph. The two systems have fundamentally different coordinate spaces and lifecycles:
| Concern | Game World | UI Layer |
|---|---|---|
| Coordinates | World space (camera-transformed) | Absolute screen pixels |
| Physics | Yes | No |
| SpriteBatch transform | Camera matrix | Identity (no matrix) |
| Draw order | Per frame, sorted by depth/layer | Painter's algorithm, tree order |
| Lifetime | Managed by scene | Managed by UI tree root |
Always render UI in its own SpriteBatch.Begin() call after the world batch, with no transformMatrix: