PM> Install-Package MonoGame.Console.WindowsDX
MonoGame is an open source implementation of the Microsoft XNA 4.x Framework.
MonoGame Console - a terminal emulator (forked from XNAGameConsole by Andreas Grech) with unicode & MonoGame support.
- Windows (DirectX)
- Add your own commands
- Customizable Options
- Clipboard Support
- External Writing
- Command Auto-Complete
- Command History
-
Create a XNB file with your SpriteFont or use default from repository (or Nuget) "Content" folder
-
Add the code below to your LoadContent() logic
Services.AddService(typeof(SpriteBatch), spriteBatch); GameConsole console = new GameConsole(this, spriteBatch, new GameConsoleOptions { ToggleKey = 192, Font = Content.Load<SpriteFont>("ConsoleFont"), FontColor = Color.LawnGreen, Prompt = "~>", PromptColor = Color.Crimson, CursorColor = Color.OrangeRed, BackgroundColor = new Color(Color.Black, 150), PastCommandOutputColor = Color.Aqua, BufferColor = Color.Gold }); console.AddCommand("ping", a => { // TODO your logic return String.Format("pong"); });
-
Run game and press '~' (tilda) to open console
-
Once instantiated, the GameConsole class adds itself as a Service, which means you can get access to it with the following:
GameConsole console = (GameConsole) game.Services.GetService(typeof (GameConsole));
MonoGame Console is released under GNU GPL v3.