XNA Developer Console

Today I have been working on a Dev Console, similar in function to the native Console class, except that it is inside the game instead of in cmd. I want to make the class completely self contained so it can be easily dropped into any project.

Once complete, which shouldn’t take longer than another day, it should be an immense help to my development process as it means I will no longer need to use a string of breakpoints to track a variables progress. After cleaning the code up a bit I will release the class here for anyone to use. I aim to include the following features in the class by tomorrow, but almost all of them are complete at this point:

  • Entirely static – should be equally accessible from any class in the project.
  • Methods for defining the width, height and position of the console on the screen.
  • Functionality for clearing the console.
  • Methods to write either a single line or a list or array of lines.
  • Both of the above including an optional sender variable to be displayed after the message. All lines will display an index number justified to four places, e.g. 0001, 0002 … 0103.
  • Contains Update and Draw methods that allow for scrolling up and down the window with either the mouse wheel or chosen keys.
  • Options for displaying the console, for example key toggle or push to display.

An example line output would be:

0001: Variable A set to 100 [Project.Game1]

Eventually I would like to  include the following features, but they will most likely be added on my own need-to-use basis:

  • Input; reading lines and then executing a method defined by the input.
  • Ability to quickly drag-and-drop the window around the screen for custom positioning while in-game.
  • Output saved to a text file.
  • Customizable syntax options.
  • Indentation options to indicate lines having parents.
  • A sort of region option in order to expand or collapse areas of the list.
  • A ‘light’ version of the console that doesn’t include the built in update and draw methods and associated variables – simply supplying a list of strings to be interpreted by a UI of your choice.

Leave a Reply

Your email address will not be published.