Initialize Monogame without window?

I was just wondering if it was possible to make a monogame library it which I use graphics, sound and input but without the game class or game window?

something like modules in which they auto initialize when they are used.

MonoGame isn’t written to be modular and you’ll find input and graphics (for OpenGL more than others) are closely tied to the window, so it’s not easy having a system that does then modularly. There’s ways to run MG without Game or GameWindow though, as shown by the projects embedding MG inside WinForms for example. But it’s not like you can easily disable parts of MG or anything like that.

What’s the your purpose, your end goal with this? I’m not sure MG is suited for it.

well I want to make a static module library that I can use in a monogame project or window

something simple that contains the following…

  • a system module
  • a graphics module
  • a sound module
  • a input module
  • a object module

I want to use monogame because its cross platform and uses C# code it which both are very valuable
also monogame forms :smiley:

I don’t understand what you mean.
How would you define a module? You want to be able to only load some of the modules? Do you want to be able to swap out a MG module for something else? You have a use case in mind or is it not so much a practical project?

no swapping I just want to be able to use it easily in the engine and editor
I want to make a cross platform zelda like editor.

the module would be used something like this…

protected override void Draw()
var img = Gfx.NewImage("Test.png");
Gfx.Draw(img, 0, 0, img.W, img.H, 0)

@Jjagg so here is a example of what I need to do to get monogame to run without a game class…
public class Sys { SysManager Manager; internal static ContentManager Content { get; private set; } = ???; internal static GraphicsManager Graphics {get; private set; } = ???; internal static SpriteBatch Sprites { get; private set; } = ???;
I need to know how to get a handle on these objects without the gameclass.
then I use them to create my moduals


idk this is one of the reasons I dislike monogame.
I would like to just be able to draw and create content without having to use a game class.
then I could just use it later in the game loop I desire.

is there no solution for this problem?
is there anyway to add support for something like this?

It’s definitely possible, but very tricky. There’s some articles about it, but I can’t tell you how to go about it off the top of my head.

I also dislike how MG pretty much forces you to use the Game class, but part of that is because of the XNA API that it inherited, so it’s hard to solve the issue.