Page 1 of 1
In game console<SOLVED>
Posted: Tue Jun 15, 2010 5:33 pm
by mv2112
How would you go about making a in-game console for debugging and such? I'm looking for ideas. Should it be a class? Or should it just be a console function that loops until exit is typed or something? Right now i'm not worried about the functionality, just the rendering. Should i check for every keypress and add the character if that key is pressed? How should i go about this?
Re: In game console
Posted: Tue Jun 15, 2010 5:38 pm
by XianForce
Well I'd say it should be a class for sure...
for string input, check
this out.
So really just pass any key press events to the instance, and then update it...
Re: In game console
Posted: Wed Jun 16, 2010 12:34 am
by Milch
My console is a class and all of the other variables get registerd in a linked list with a string and a pointer to the real variable.
Also, it has a bitflag if it should be saved in a file if the program is closed.
It has a function called 'ToggleConsole' and whenever this is called, it opens/closes the console.
For the input I have somekind of priority system.
So, my code looks more less like this:
Code: Select all
if( console->IsActive() ) //The highest priority
console->Input( Event );
else if( menu->IsActive() )
menu->Input( Event );
else //only normal game left
game->Input( Event );
In the rendering part, I just check if its active and call the function 'console->Render()' - thats all.
If you use SDL - go with the link XianForce posted above.
But if you use SFML - you have to write your own string input class ( atleast I did that, maybe there is a solution and I didnt find it... )
Re: In game console<SOLVED>
Posted: Thu Jun 17, 2010 3:57 pm
by mv2112
XianForce wrote:Well I'd say it should be a class for sure...
for string input, check
this out.
So really just pass any key press events to the instance, and then update it...
Yes, this is perfect, great info. I think im gonna perfect my text system before i make a console though...