ASCII/Text based games...

Started by
3 comments, last by wyrd 20 years, 12 months ago
I''ve been browsing these forums and noticed a couple of references to ASCII/Text based games, such as Tetris and Pong. I''d love to get started on games, even if it''s silly little ASCII/Text based games (need to start somewhere). These sound easy enough, however I believe I don''t have enough knowledge to actually put together the moving parts here, heh. I''m a little confused as to how you make text move on the screen constantly and still accept input from the user at the same time. cin stops and waits for the user to imput something, and that''s obviously not good as you''d want to keep the ball in pong moving. So, am I missing something here? I was thinking that maybe I need knowledge of the API so I can detect key strokes from the user. But still, how would one give the illusion of moving text? Clear the screen and re-draw everything like you would with a 2d game? I''m pretty familiar with the basics of C/C++, unfortunately my knowledge doesn''t extend to the windows API. If API is needed I''m usually doing the project in .NET. In this case, however, I feel it''s vital that I learn how to do this in C/C++ if I''m going to program any real games in the far future. If someone could clue me in here and fill my missing gap, that''d be great. Even just a link to a tutorial would work fine. If I do indeed need to learn windows API, I would love to know what a good book for that would be.
Advertisement
For console programs, all you need for keyboard input is kbhit().
For the graphics, try looking up CONSOLE_SCREEN_BUFFER_INFO.
Do you know where one might find more information on kbhit? I found CONSOLE_SCREEN_BUFFER_INFO in vs.net itself, but neither of the two showed up in an msdn search...Thanks much.
CONSOLE_SCREEN_BUFFER_INFO was found here...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_screen_buffer_info_str.asp

kbhit() seems to be a little harder to pinpoint, I searched google for it and came up with this...

http://www.nibbleguru.com/probs/162/5
Is there any actual info on that nibbleguru site? He says its in conio.h but I understand that conio.h isn''t standardized and as such is a bad idea to use...is that the case ehre as well?

This topic is closed to new replies.

Advertisement