Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: MoNksBaNe_Agahnim on November 16, 2003, 06:08 PM

Title: Using arrow keys
Post by: MoNksBaNe_Agahnim on November 16, 2003, 06:08 PM
I found the hexdecimal code for using the arrow keys, how would i plug it in to make an X that appears on the screen (know how to output an "x" hehe) be able to move the X around the screen?

[edit]:change of subject
Title: Re:Using arrow keys
Post by: Spht on November 16, 2003, 08:28 PM
Variables X and Y store the location of "X." When KeyDown is pressed, Y += 1; when KeyUp is pressed, Y -= 1; when KeyRight is pressed, X += 1; when KeyLeft is pressed, X -= 1.

When you're done that, draw an "X" (how to do that depends on what you're using) at the coordinates X, Y.
Title: Re:Using arrow keys
Post by: Eibro on November 16, 2003, 08:30 PM
See: SetConsoleCursorPosition() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setconsolecursorposition.asp)
Title: Re:Using arrow keys
Post by: iago on November 17, 2003, 02:45 AM
Quote from: Spht on November 16, 2003, 08:28 PM
Variables X and Y store the location of "X." When KeyDown is pressed, Y += 1; when KeyUp is pressed, Y -= 1; when KeyRight is pressed, X += 1; when KeyLeft is pressed, X -= 1.

When you're done that, draw an "X" (how to do that depends on what you're using) at the coordinates X, Y.

I think he was more concerned about how to draw the x in c++ :P
Title: Re:Using arrow keys
Post by: Spht on November 17, 2003, 12:28 PM
Quote from: iago on November 17, 2003, 02:45 AM
Quote from: Spht on November 16, 2003, 08:28 PM
Variables X and Y store the location of "X." When KeyDown is pressed, Y += 1; when KeyUp is pressed, Y -= 1; when KeyRight is pressed, X += 1; when KeyLeft is pressed, X -= 1.

When you're done that, draw an "X" (how to do that depends on what you're using) at the coordinates X, Y.

I think he was more concerned about how to draw the x in c++ :P

Redundant help is better than no help.