It is currently Sun Oct 22, 2017 6:40 am

All times are UTC - 5 hours




 Page 1 of 1 [ 8 posts ] 
Author Message
 Post subject:
PostPosted: Wed Jul 11, 2007 5:35 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
VMK34A/B shows you how to setup the game engine so that we can create an animated console window when the TAB key is pressed. I start by cleaning up the structure of the game engine and then I create the UserSettings class that allows us to pass data between the GameOGL class and the Scene class very easily. The ConsoleParam struct is also created which is used to contain all the console window parameters.



In VMK34C, I add keyboard control to the console window to enable and disable the FPS output. I also show you how to attach text to the console window so that it scrolls up and down when the TAB key is pressed


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 34 - Console Window
PostPosted: Tue Jul 17, 2007 4:42 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
In VMK34D I add the ability to echo key presses on the keyboard to the console window. A bit of ascii work is done here to get what we need. If you would like a refresher on Hexadecimal numbers check out this C++ VMK.



In VMK34E we take the keyboard input string that a user types into the console and we parse it to perform operations inside the game engine during run time.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 34 - Console Window
PostPosted: Sun Jul 22, 2007 1:49 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
Oops! I forgot to delete the variable m_bQuit from the GameOGL class and because of this a few instances of m_bQuit need to be replaced with the m_pUserSettings->m_bQuit variable. In VMK35A I show you how to make the necessary changes.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 34 - Console Window
PostPosted: Mon Jul 23, 2007 5:30 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
VMK34F makes a small modification to the ConsoleRender function so that we can replace the yellow rectangle with a texture in the console window.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 34 - Console Window
PostPosted: Thu Sep 06, 2007 5:42 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
I have a feeling that I may have introduced a compiling bug into the GameEngine project when I restructured the organization of the project in VMK34A. I am finishing up some work now on VMK38C and I see that the project doesn't build properly. If you are having problems compiling your program, let me know and I can tell you how to fix it. Alternatively, watch VMK38C and you will see how to fix everything.


Offline
 Profile  
 
 Post subject: Add more options!
PostPosted: Thu Nov 04, 2010 9:23 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 449
At the end of VMK34D I added these lines of code into the ConsoleInput() function inside the Scene Class...

if ( VK_CODE == VK_LEFT )
{
   if ( m_ConsoleParam.iChar < 0 )
   {
      m_ConsoleParam.iChar = 0;
   }
   m_ConsoleParam.iChar--;
}

if ( VK_CODE == VK_RIGHT )
{
   if ( m_ConsoleParam.iChar > CONSOLE_MAX_LENGTH )
   {
      m_ConsoleParam.iChar = CONSOLE_MAX_LENGTH-1;
   }
   m_ConsoleParam.iChar++;
}


The idea here is to traverse through the string of text when the user uses the arrow keys. The code does work! :), but not as expected...

If I am to type this text into the console "Some Text Here" there are 14 chars in this string... If I am to press the left arrow key say 4 times it will be right before the letter "H" but if I type a character, it gets over written like MS Word. My question is, with this frame work how would I go about inserting text at this point and add in the effect of a cursor, to show the current position in the string?


Offline
 Profile  
 
 Post subject:
PostPosted: Fri Nov 05, 2010 5:36 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
iChar keeps track of your current position in the string so that when you press a key the new letter gets saved at this location. You are always in "overwrite" mode.

If you want to create an "insert" operation you'll need to modify the code slightly. Instead of overwriting the current letter at the location iChar, you want to shift all the letters found to the right, over by one to make room for the new character that was pressed. That should do the trick!


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Nov 06, 2010 5:26 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 449
That makes sense, but not sure on how to implement it!


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron