This project is read-only.

How to use Xna Console with your game

This is pretty simple.
  • Include the files XnaConsole.cs, and PythonInterpreter.cs in your project. PythonInterpreter.cs is only necessary if you want to use IronPython as your interpreter. Also, if you do use IronPython, you will need to reference IronPython.dll and IronMath.dll.
  • Add "using XnaConsole;" to the using statements where your game class is defined.
  • Add these lines to your game in the variable declaration section:

PythonInterpreter interp;

and in the constructor or initialize method say:

interp = new PythonInterpreter(this, Content.Load<SpriteFont>("ConsoleFont"));
interp.AddGlobal("game", this);

where "ConsoleFont" is a spritefont of your choice. I usually use Consolas, as can be seen in the example project.
  • Run your game! That was easy.

Last edited Apr 5, 2008 at 9:49 PM by Shader, version 2


No comments yet.