• Advertisement
  • entries
  • comments
  • views

I love systems programming

Sign in to follow this  


Not saying that I don't like math intensive programming like graphics programming and such, but I seem to have the most fun working on stuff like the inners of a GUI or debug console.

Speaking of which, I'm almost completely finished with the debug console. I got it setup so that the rendering can be overwritten, it now supports hexadecimal values for integers and string, fixed some minor bugs, and separated everything into header and source files.

I've decided to drop function-return variable assignment since it would require me to do one of the following:
1) Have the user pass around void pointers (this also requires 3)
2) Force the user to interact with the DebugConsoleVariable class (still mucking with void pointers and also requires 3)
3) Setup some sort of script-style variable allocation so that I can pass around pointers.

Edit: Actually, I may be able to work it in, it'll just require another DebugConsoleVariable type class (name DebugConsoleFunctionReturn.) It'll be a bit big (would include an int, a union with an int, float, and bool, and then a std::string.) But, I could manage to work it in and it would be nice. Also, you wouldn't be forced to interact with the actual class as I'll include constructors. I'll try this out and keep you updated!

Anyway, I'll be posting the header and source for the debug console system tomorrow (no matter what.) Just be wary that it uses void pointers extensively and C-style casts and, isn't type safe. It's kind-of type safe, as long as you don't go mucking around with the variables in your function. I'll write up some documentation to go with it that'll go over everything.

Once I get this finished up I'll be continuing the work on my sidescroller. I wanted to get the debug console done first since it'll be really helpful.

I actually started to work on the sidescroller yesterday and ran into an issue. For some reason when I switched to a smaller resolution the smooth-scrolling started to stutter (the screen's resolution changed, but the window size stayed the same.) That's why I decided to work on the debug console[lol].


WOOT!!! I got it working completely in a little under an hour and a half. I'm including another value in the DebugConsoleReturnVariable class, Error. It's a boolean that will allow the user to specify that the function had an error and is returning before the function finished. You can also supply an error message via the std::string String member. It was actually A LOT easier than I was expecting it to be.

Of course, something else has been brought to my attention that I probably should support, but methinks this thing is getting a little too complicated. The new thing is functions as function arguments (namely so you could do stuff like use argb() as a function argument) but I don't think I'm going to. To tell you the truth, I didn't really even need to include function-return variable assignment, but it will make stuff like setting a color easier and more intuitive. Plus it gave me experience for when I write my scripting language[lol].

I actually got lucky because I thought ahead last night. When I first started working on it, I just had "ParseInput(const std::string& Input)" which would parse any string (I allow input so that commands can be run via code.) But then I decided to split it into ParseInput() which was public and then HandleOperation(const std::string& LeftHandSide, const std::string& Operation, const std::string& RightHandSide) which was private. This would have worked for both variable operations and functions (LeftHandSide would be the function name, Operation would be empty, and RightHandSide would contain the comma-separated arguments.) But, I then decided to split it even further to the current:

void ParseInput(const std::string& Input);
void HandleVariableOp(const std::string& LeftHandSide, const std::string& Operation, const std::string& RightHandSide);
DebugConsoleReturnVariable HandleFunctionCall(const std::string& FunctionName, const std::string& ArgumentsList);

Since I already handle function parsing separately, I just had to add a case in my RightHandSide parsing (in HandleVariableOp) to see if I ran into a '('. If so, I'm parsing a function (as long as I'm not in quotes.) Then I just parse the arguments list (until I find a ')') and then pass the info on to HandleFunctionCall().

I'm cleaning up the code a little bit before I upload it, but it'll be up before I go to bed. Again, I warn you that the code isn't the best. Normally I would stay away from void pointers but they really made this a lot easier. Also, the parsing (which is over half of the source) is pretty scrambled and isn't commented at all (I wasn't planning on releasing it originally, but then I figured why the hell not.)
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement