Computer Science Canada getch & hasch |
Author: | appling [ Sat Nov 22, 2003 4:12 pm ] |
Post subject: | getch & hasch |
i am worried about my homework. i don't know getch & hasch clearly.So is there anyone can help me?? how to use getch & hasch. |
Author: | Tony [ Sat Nov 22, 2003 4:31 pm ] | ||||
Post subject: | |||||
getch grabs a single character from the input buffer.
hasch returns true if there's anything in input buffer waiting to be processed. It is generally used to skip getch so that program continues even without user's input.
|
Author: | Mazer [ Sat Nov 22, 2003 4:33 pm ] | ||||
Post subject: | |||||
use getch to get a character. like this:
use hasch to see if a character has been pressed. like this:
|
Author: | appling [ Sat Nov 22, 2003 4:44 pm ] |
Post subject: | |
so,if i have a graphics program that have 2 scene, and i want to change the scene A to scene B immediately by pressing the keyboard, also later change the scene B to scene A immediately by pressing the keyboard. what can i do?? |
Author: | Tony [ Sat Nov 22, 2003 6:09 pm ] | ||
Post subject: | |||
you can do
|
Author: | appling [ Sat Nov 22, 2003 9:37 pm ] |
Post subject: | |
but how to change 2 to 1 then |
Author: | Tony [ Sat Nov 22, 2003 9:46 pm ] |
Post subject: | |
you exit your loop and start another one, this time waiting to draw scene1 |
Author: | Blade [ Sat Nov 22, 2003 10:23 pm ] | ||
Post subject: | |||
you could also just use one loop and use a boolean var..
|
Author: | appling [ Sat Nov 22, 2003 11:15 pm ] |
Post subject: | |
thanks i get it |