Stand Alone Neat Console

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:

  1. Create a regular Windows Game project.

    StandAloneConsole1

  2. 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.)

    StandAloneConsole2

    StandAloneConsole3

  3. Create a Neat.Components.Console object:
    Neat.Components.Console console = new Neat.Components.Console(this);
  4. Add the console object to your game’s components:
    Components.Add(console);
  5. 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;
  6. 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();

    StandAloneConsole4

Adding commands is like before, just create a function that returns void and accepts a IList<string> as parameter and hook it to the console by writing console.Add(commandName, function);

That’s all.

Download Neat Game Engine: http://neat.codeplex.com

Advertisement

Posted on December 14, 2010, in Game Development / XNA and tagged , , , . Bookmark the permalink. 2 Comments.

  1. Hey, that’s awesome.

    Detecting key presses using a polling mechanism can miss keys when the framerate stutters, and it can switch key press order if they are pressed in the same frame. Ideally you need to listen to keyboard events at a lower level, Promit’s code here does exactly that. http://www.gamedev.net/community/forums/topic.asp?topic_id=457783

    Also, it would be pretty easy to use reflection to bind a function that took any sort of arguments, so long as those arguments could be converted from string.

    • Thanks,
      I know that the current input method used by the console has these problems, and I will find a way to fix them. I also have to mess with the draw method of the console to be able to introduce colors to it.

      Promit’s code uses Windows API, I’m not sure I can use it in Windows Phone versions of the game :-/

      The reflection is a good idea, I will implement it in the future. right now you have to convert the parameters manually. ;-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 40 other followers