MonoGame-WinFormsControls icon indicating copy to clipboard operation
MonoGame-WinFormsControls copied to clipboard

Template code for embedding MonoGame utilities and games into WinForms controls.

MonoGame-WinFormsControls

This project contains a library with basic controls for embedding MonoGame content in WinForms. The library can be used as-is, or it can be integrated directly into your codebase for further customization.

The control code is originally derived from the MSDN tutorial WinForms Series 1: Graphics Device.

This code also supports a series of tutorials on embedding MonoGame in WinForms:

The intent is for this repository to unify the tutorials into a single solution that can be used as a template for actual projects.

Project Structure

  • Control Example
    • ExampleControl -- A sample control tracking mouse events to draw squares. Updates as needed as opposed to running an update loop.
  • Game Example
    • ExampleGame.Common -- A sample game engine, representing the majority of game implementation.
    • ExampleGame.Embedded -- A WinForms project. Runs the shared game code from an embedded GameControl class. Also include extra WinForms interactions.
    • ExampleGame -- A standard MonoGame project. Runs the shared game code from a normal Game class.
  • MGWinFormsControls -- A basic library containing GraphicsDeviceControl and GameControl base controls.