Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

int main(int argc, char * argv[]) (command line args)

This topic is 5951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a text game where the player enters commands in a console window. I've seen other games that allow the user to press the UP ARROW key to display the last 10 or so messages (1 at a time. I know the formal parameters to main are int argc, char *argv[], but how would I be able to do this in my game? Thanks much. Edited by - randomDecay on February 3, 2002 1:20:11 PM

Share this post


Link to post
Share on other sites
Advertisement
I don''t think the main() parameters have anything to do with this. I''m guessing you mean you''re making your own console, not implementing the game through multiple executions of the program from the command line, in which case it would be the shell''s job for the "UP and DOWN" arrows.

(http://www.ironfroggy.com/)
(http://www.ironfroggy.com/pinch)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
not sure but i think you could use GetASyncKeyState() in windows.h to get the current status of any key but i can''t remember the arguments.

Share this post


Link to post
Share on other sites
try:

game loop ()
{
MSG msg;
if(PeekMessage(&msg,0,0,0,PM_REMOVE))
{
TranslateMessage(&msg);

if(msg.message == WM_KEYDOWN)
{
if(msg.wParam == VK_UP)
//do stuff
}
else if(msg.message == WM_QUIT)
// quit
if(msg.message == WM_CHAR)
{
if(msg.wParam == 'A')
//do stuff
}
}
}

Edited by - AlexM on February 3, 2002 3:00:05 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!