MonConLib 1.0.1
dotnet add package MonConLib --version 1.0.1
NuGet\Install-Package MonConLib -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MonConLib" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MonConLib" Version="1.0.1" />
<PackageReference Include="MonConLib" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MonConLib --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MonConLib, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MonConLib@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MonConLib&version=1.0.1
#tool nuget:?package=MonConLib&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MonConLib
A console library for MonoGame Framework applications that provides an in-game debug console with command tree navigation.
Features
- Interactive Console: Toggle-able in-game console overlay
- Command Tree Structure: Hierarchical command organization
- Parameter Support: Various parameter types (toggle, numbers, strings, methods)
- Logging System: Built-in logging with timestamps
- Keyboard Input: Full keyboard input handling with history scrolling
Usage
// Create logger and commander
var logger = new ConsoleLogger();
var commander = new ConsoleCommander();
// TODO: Add your initialization logic here
_consoleHandler = new ConsoleHandler(new ConsoleLogger(), new ConsoleCommander());
_consoleHandler.AttachToWindow(Window);
int startLevel = 0;
int width = 10;
int height = 10;
bool isDebugMode = true;
// SETUP THE MONCON CONSOLE COMMANDER//
//You can setup the console commander by creating a node, then attatch new nodes to it.
//Create a node for Game specific commands
var gameNode = new ConsoleCommandNode("game");
//Create a node for grid specific commands
var gridNode = new ConsoleCommandNode("grid");
//Create a node for debug commands
var debugNode = new ConsoleCommandNode("debug");
var loadLevelNode = new AnyNumbersParameterNode("loadLevel", startLevel.ToString(), LoadLevel);
//Create a parameter node for setting the grid size
var gridSizeNode = new NumbersPairParameterNode("gridSize", (width, height), (x, y) => { SetGridSize(x, y); });
//Create a parameter node for exiting the game
var exitNode = new MethodParameterNode("exit", new ConsoleCommandSignature("now", () => { System.Environment.Exit(0); }));
//Create a parameter node for toggling debug mode
var debugModeNode = new ToggleParameterNode("debugMode", isDebugMode ? "on" : "off", SetDebugModeOn, SetDebugModeOff);
gameNode.AddNode(exitNode);
gameNode.AddNode(loadLevelNode);
gridNode.AddNode(gridSizeNode);
debugNode.AddNode(debugModeNode);
_consoleHandler.AddNode(gameNode);
_consoleHandler.AddNode(gridSizeNode);
_consoleHandler.AddNode(debugNode);
// In your Game class Update method
consoleHandler.Update(gameTime);
// In your Game class Draw method
consoleHandler.Draw(spriteBatch);
USAGE
- Use the _consoleHandler.ToggleConsole() to open/close the console
- Use ":" to start a command - pressing enter will list the available nodes in the current node
- Use "->" to invoke a command
Example:
- Open Console
- :game:gridsize->12,12
Requirements
- .NET 8.0
- MonoGame Framework 3.8.1.303
Installation
Install via NuGet Package Manager or use the Package Manager Console:
Install-Package MonConLib
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- MonoGame.Framework.DesktopGL (>= 3.8.1.303)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.