Tuesday, June 14, 2005

Well my console is practically finished (working and can be used)

I did mention that I was going to give a tutorial but I'm not! It required far more work than I expected. (to do it the way I wanted that is. Basically I first built a very nice GUI library - totally modular and apart from my code. Then I tested it with my code and resolved any problems. Then on top of the library, again away from my code I wrote a console object. I borrowed some code from my earlier attempts and finished with something I think is very cool).

The last step is to link it entirely with my code and LUA. This will be easy.

Everytime a command is entered a "Command Entered" delegate is fired. So I just hook this up to a function, do some preprocessing for special commands (like reset_lua or load_map_maker) and then pass it to Lua to sort out. All Lua's textual output can go through the consoles output pane.

There's a command history which works well. I've locked the number of items at 10 though this is invisible to the user - apart from they can only go back 10 steps. This is a simple const and is easy to change. I'd just use an array list or something but unbounded memory (even as an unlikely a problem as this) always worries me, so I've clamped it down. 50 should be more than enough for the final thing.

It can have any kind of image background and I think can do transparency and alpha blending with an extra call. (as supported by GUI library) Fonts and colours can also be tweaked in similar calls. I'm happy with it enough for my main game now.

Functionality wise it's the quake standard. It doesn't display all key strokes yet but this is just a little fiddling with the text box class. There's an input pane, pressing enter on this transfers the command to the output pane above it. This is all placed on a console window that drops down from the top of the screen on a keypress.

Main game itself is looking a lot better lately as well. Of course you can't actually play at the moment but the start menus are far prettier :D The next stage will be fleshing out a good proporition of the menu system before you get to the game. This will allow testing to go a lot quicker.
Post a Comment