Position in a C++ Console App

Started by
13 comments, last by NashuNatta 20 years, 8 months ago
heres a little snippet from a game ive been working on, Im unclear as to what youre trying to do but maybe this will help ...
 		switch(_getch())			{				case 75:					bLeft = true;					//left					break;				case 77:					bRight = true;					//right					break;				case 72:					bRotCounterClock = true;					//up					break;				case 80:					bRotClock = true;					//down					break;			}


As you can see, for the arrow keycodes i have 75 for left, 77 for right, 72 for up and 80 for down.

Is this what you are looking for?
Advertisement
wow. That was the stupidest problem ever. I didnt add the _ before getch(). I dont know why _getch() is diff from getch() but it is and that is what made the diff. Thanks alot.
____________________________________________________________[email=UntimelyDeathProductions@yahoo.com][E-mail me][/email]
The underscore indicates that the function is non-standard (of course, just because a function doesn''t have one, doesn''t mean that it''s standard). Whenever you can use a standard function, do. The standard equivalent to getch is getchar, which is in stdio.h.
quote:Original post by NashuNatta
wow. That was the stupidest problem ever. I didnt add the _ before getch(). I dont know why _getch() is diff from getch() but it is and that is what made the diff. Thanks alot.



_getch() is the actual library function, getch() is just a #define to it.

youre welcome.
quote:I said ...
_getch() is the actual library function, getch() is just a #define to it.


Hrmmm it appears I could be wrong about that, hopefully someone with a little more experience than myself will come along and set the record straight, because it would be interesting to know.

This topic is closed to new replies.

Advertisement