In game console<SOLVED>
Moderator: Coders of Rage
- mv2112
- Chaos Rift Junior
- Posts: 240
- Joined: Sat Feb 20, 2010 4:15 am
- Current Project: Java Tower Defence Game
- Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
- Programming Language of Choice: C/++, Java
- Location: /usr/home/mv2112
- Contact:
In game console<SOLVED>
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?
Last edited by mv2112 on Thu Jun 17, 2010 3:57 pm, edited 1 time in total.
Re: In game console
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...
for string input, check this out.
So really just pass any key press events to the instance, and then update it...
- Milch
- Chaos Rift Junior
- Posts: 241
- Joined: Sat Jul 11, 2009 5:55 am
- Programming Language of Choice: C++
- Location: Austria, Vienna
Re: In game console
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:
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... )
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 );
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... )
Follow me on twitter!
- mv2112
- Chaos Rift Junior
- Posts: 240
- Joined: Sat Feb 20, 2010 4:15 am
- Current Project: Java Tower Defence Game
- Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
- Programming Language of Choice: C/++, Java
- Location: /usr/home/mv2112
- Contact:
Re: In game console<SOLVED>
Yes, this is perfect, great info. I think im gonna perfect my text system before i make a console though...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...