All Projects → BlizzCrafter → MonoGame.Forms

BlizzCrafter / MonoGame.Forms

Licence: MIT License
MonoGame.Forms is the easiest way of integrating a MonoGame render window into your Windows Forms project. It should make your life much easier, when you want to create your own editor environment.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to MonoGame.Forms

MonoGame.SplineFlower
Create wonderful smooth Bézier-, CatMulRom- and Hermite-Splines with Trigger Events for your MonoGame project.
Stars: ✭ 18 (-90.16%)
Mutual labels:  nuget, engine, monogame, windows-forms, engines, monogame-framework, editors
Monogame.forms
MonoGame.Forms is the easiest way of integrating a MonoGame render window into your Windows Forms project. It should make your life much easier, when you want to create your own editor environment.
Stars: ✭ 165 (-9.84%)
Mutual labels:  visual-studio, nuget, engine, monogame, windows-forms
Steamworks.Net-MonoGame-Integration
This repo is for everyone who is about to integrate the Steamworks.Net.dll into a MonoGame project. It shows some Steamworks.Net features and how easy it is to integrate it into a MonoGame project.
Stars: ✭ 30 (-83.61%)
Mutual labels:  steam, monogame, monogame-framework
Active-Directory-Search
👤 This Active Directory Search tool was written in C# and VB.NET Windows Forms and exports the results from LDAP to csv format.
Stars: ✭ 19 (-89.62%)
Mutual labels:  visual-studio, windows-forms
EmptyLicensesLicx
Easy continuous integration of apps using third-party controls that rely on licenses.licx files
Stars: ✭ 57 (-68.85%)
Mutual labels:  visual-studio, nuget
Apos.Shapes
Shape rendering in MonoGame.
Stars: ✭ 21 (-88.52%)
Mutual labels:  nuget, monogame
MonoGame.Primitives2D
Easy-to-use 2D primitives
Stars: ✭ 44 (-75.96%)
Mutual labels:  monogame, monogame-framework
crynn
3D Game Engine Created In C++ & OpenGL
Stars: ✭ 45 (-75.41%)
Mutual labels:  visual-studio, engine
Bing-Maps-V8-TypeScript-Definitions
This project contains the TypeScript definitions for the Bing Maps V8 Web Control.
Stars: ✭ 36 (-80.33%)
Mutual labels:  visual-studio, nuget
DungeonMaster.NET
Reimplementation of famous old Dungeon Master game.
Stars: ✭ 23 (-87.43%)
Mutual labels:  engine, monogame
MLEM
MLEM Library for Extending MonoGame provides extension methods, improvements and additional features like a ui system and easy input handling.
Stars: ✭ 26 (-85.79%)
Mutual labels:  monogame, monogame-framework
cocos2d-mono
Continuation of Cocos2D-XNA project, with focus on MonoGame
Stars: ✭ 18 (-90.16%)
Mutual labels:  monogame, monogame-framework
Spatial.Engine
[WIP] Spatial is a cross-platform C++ game engine.
Stars: ✭ 50 (-72.68%)
Mutual labels:  engine, engines
Standard-Toolkit
An update to Component factory's krypton toolkit to support .NET Framework 4.6.2 - 4.8.1 to .NET Core/.NET
Stars: ✭ 194 (+6.01%)
Mutual labels:  visual-studio, nuget
UnityAssemblies
Simple, forward-compatible references to ANY Unity DLL on ANY platform.
Stars: ✭ 65 (-64.48%)
Mutual labels:  visual-studio, nuget
TfsCmdlets
PowerShell Cmdlets for Azure DevOps and Team Foundation Server
Stars: ✭ 75 (-59.02%)
Mutual labels:  visual-studio, nuget
MIST
Implements change notification for properties (ie: INotifyPropertyChanged) using IL weaving and a custom Visual Studio build task.
Stars: ✭ 51 (-72.13%)
Mutual labels:  visual-studio, nuget
Krypton-Toolkit-Suite-Extended-NET-5.470
An extension to the Krypton Toolkit suite of controls for .NET framework 4.7
Stars: ✭ 51 (-72.13%)
Mutual labels:  visual-studio, nuget
chat-app
Multithreading TCP server and client communicating over TCP/IP - Windows Forms Application.
Stars: ✭ 39 (-78.69%)
Mutual labels:  visual-studio, windows-forms
Facepunch.Steamworks-MonoGame-Integration
Facepunch.Steamworks + MonoGame.Framework = the easiest SteamAPI Integration for your app!
Stars: ✭ 18 (-90.16%)
Mutual labels:  steam, monogame

Banner

Welcome to MonoGame.Forms!

Twitter Follow Wiki License

Visual Studio

NuGet NuGet

NuGet NuGet

NuGet

MonoGame.Forms is the easiest way of integrating a MonoGame render window into your Windows Forms project. It should make your life much easier, when you want to create your own editor environment.

Building

  • The MonoGame.Forms.DX project uses a modified version of the MonoGame.Framework 3.8.0.270, which is already precompiled and included in this repo.
  • The MonoGame.Forms.GL project uses a modified version of the MonoGame.Framework based on the development build from 16th of JULY 2018.

Tips & Tricks / Dos & Don'ts

The OpenGL version of the library currently renders differently than the DirectX one, which makes it generally slower. If you need as much perormance as possible, you should definitley use the DirectX library.

  • Boost performance of a custom OpenGL control by raising its DrawIntervall with the property window during design time (try 50ms or 100ms. 1ms aims to 60 fps)
  • Never use DoubleBuffering on a custom control. This counts for the OpenGL library as well as for the DirectX library! It will cause flickering and slow downs.
  • If you experience scaling issues with your drawn content, then you might want to set the right AutoScaleMode of a Form containing a MonoGameControl: AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;. If you want to turn off scaling of your whole application, then you need to add a Manifest-File.
  • If you need to have the MonoGame-PipelineTool integrated into your MonoGame.Forms project, you should check out the PipelineTool-Tutorial! NEW: Now you can also directly install the Visual Studio templates or use the combined NuGet-Packages [DX | GL] !

How-To

Setup MonoGame.Forms

First you need to make your MonoGame.Forms library ready to use. This step is very easy; you just need to compile either the MonoGame.Forms.DX or the MonoGame.Forms.GL PCL from source and then just add the compiled DLL's to your project.

This is the prefered route, when you want to make you own custom changes to the library or extend it.

Another option is to install the library with the NuGet package manager:

NuGet

This is the prefered and easiest route to be automatically up to date.


Tutorial

The following tutorial is working exactly the same on both libraries (DX and GL).

Creating a simple MonoGameControl

Let's start using the MonoGame.Forms library by creating a simple control to render stuff!

(it's assumed that you already have created a new Windows Forms project with the installed library)

  1. Create a new class and name it DrawTest
  2. Inherit from MonoGame.Forms.Controls.MonoGameControl
  3. Override its Initialize(), Update() and Draw() method
  4. Save your solution
  5. Build your solution
  6. Double Click on Form1.cs so that the designer opens
  7. Open the Toolbox
  8. Drag & Drop the newly created control onto the Form1 control
  9. Open the Properties of the new control and set the Dock option to Fill

This is how it should look now:

Tutorial

  1. Now run the solution and see the classical CornflowerBlue-Screen you are (surly) familiar with! ;-)

Tutorial

And yes, as you can see: it is realy THAT EASY!

Now I bet you wonder how to draw something to this control, right? I bet you think that this is now the difficult part, right? Well... it's not!

More than that it's basically the same like you are used to do in the MonoGame.Framework. Just with a small difference (no it's still not difficult!)

In MonoGame you could draw someting to the screen with the SpriteBatch. In MonoGame.Forms you will do the same but you need to use the GFXService for this.

In the MonoGameControl class this service is called Editor. To draw something to the SpriteBatch you need to do this:

Editor.spriteBatch.DrawString();

Do you see? Easy! :)

The GFXService class contains some MonoGame specific stuff like a ContentManager. Examine everything calmly. I just want to explain a little how MonoGame.Forms works under the hood!

To sum things up, let's take a look at the final DrawTest class:

using Microsoft.Xna.Framework;
using MonoGame.Forms.Controls;

namespace nugetTest
{
    public class DrawTest : MonoGameControl
    {
        string WelcomeMessage = "Hello MonoGame.Forms!";

        protected override void Initialize()
        {
            base.Initialize();
        }
        
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        protected override void Draw()
        {
            base.Draw();

            Editor.spriteBatch.Begin();

            Editor.spriteBatch.DrawString(Editor.Font, WelcomeMessage, new Vector2(
                (Editor.graphics.Viewport.Width / 2) - (Editor.Font.MeasureString(WelcomeMessage).X / 2),
                (Editor.graphics.Viewport.Height / 2) - (Editor.FontHeight / 2)),
                Color.White);

            Editor.spriteBatch.End();
        }
    }
}

Result:

Tutorial

It's pretty much like in the MonoGame.Framework!

I just want to refer to the nice MonoGame.Forms.Test-Project, which is part of this repo. Take a look at it and learn from its samples.

Note: to raise the performance of an OpenGL MonoGameControl, it's recommended to change the DrawIntervall from 1ms to 50ms or 100ms!

DrawIntervall

BTW: did you notice the BackColor and ForeColor property? Changing these values makes it possible to style your controls to something like this:

Style

Do it to keep the overview and feel of your custom editor project!

Note: The MonoGame logo is placed automatically inside a newly created control (during design-time) to make it clear, that it is a render control with MonoGame functionality!


Creating a simple InvalidationControl

This specific control class doesn't need to override the Update() method, because it gets manually invalidated (by you!).

If you are changing the drawn contents of the SpriteBatch when your editor project is running (not during design time), then you simply need to call Invalidate() on a custom control for every change you want to see on your control. This command commits those changes and after that your control does not consume CPU power anymore. This process is great when creating preview controls for textures and similar things!

Sample Pics

Here are some pics of some samples included with the repo:

DX (Windows 10 Pro 64 bit)

Sample

GL (Ubuntu 18.04 LTS [Bionic Beaver] 64 bit)

Sample

Projects using MonoGame.Forms!

Please watch the following YouTube videos in 1080p @ 60fps to see what is possible with MonoGame.Forms!

This project is called: "Rogue Engine Editor" and it's possible to create Rogue Adventures with it:

Rogue Engine Editor

Twitter: #RogueEngineEditor


This project is called: "PenumbraPhysics.Editor" and it was the prototype for the Rogue Engine Editor and MonoGame.Forms:

YouTube Video

GitHub: PenumbraPhysics.Editor


Now Have Fun with MonoGame.Forms!

Twitter Follow

Logo

Special Thanks

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].