Stand Alone Neat Console - Tue, Dec 14, 2010
Today I made a few changes in Neat Console that allows it to be used outside a NeatGame class, as a stand alone component.
So, here’s how you can use Neat Console independently:
Create a regular Windows Game project.
Add a reference to Neat. (you can either do that by adding Neat project to your solution or just using the binary file. you don’t need to add any of Neat’s content files to your game.)
Create a Neat.Components.Console object:
Neat.Components.Console console = new Neat.Components.Console(this);
Add the console object to your game’s components:
Components.Add(console);
Since you are not using Neat Engine, you have to manually assign a font to the console. You can also change console’s background texture the same way. write this in your LoadContent() method:
f = Content.Load<SpriteFont>("spritefont1");
console.StandAloneFont = f;
console.StandAloneTexture = someTexture2DObject;
Now all you have to do is telling the console to draw itself each frame. (You have to do this manually since Console isn’t a drawable component):
spriteBatch.Begin();
console.Draw(spriteBatch, false);
spriteBatch.End();
Adding commands is like before, just create a function that returns void and accepts a IList as parameter and hook it to the console by writing console.Add(commandName, function);