Saturday, May 22, 2010

Visual studio 2005 epress edition, C++ console question?

I want to make a little game using C++ :-). nothing fancy, in console mode using the standerd libraries. although i'm having trouble with key scans. instead of using "std::cin%26gt;%26gt;variable name;" i want to be able to input a character with out stoping the ececution of the program. Similar to INKEY$ when using qbasic. i'v heard of GetAsyncKeyState(VK_***), but not sure if it is meant for win32 of console mode and also don't know how to use it. any help would be appreciated.

Visual studio 2005 epress edition, C++ console question?
if you dont wanna go through all the trouble of learning an opengl library or a video interface. you can think of it like this


a console is goin to have a fixed amount of column and rows you can observe.


so you would have to create a double dimensional arraylist


containing the material that you wanna see of the screen.


this double dimensional array would have maybe ---------------------------------------


| |


| |


| |


--------------------------------------


that would be a very simple example, which is going to store in your double dimensinoal arraylist of integers. and is going to refresh in a while true and print it to the cout.


you can define an special key that will exit this while loop.


if your computer is fast enough it would almost look like the picture is still and it will refresh when you make any changes to the 2d arraylist.
Reply:you may find using openGL libraries much easier. They give you tools to do nice graphics also. It's more event driven that way, similar to VB, you write functions to handle events (for instance keypresses, mousebuttons down, and mousebuttons up).


No comments:

Post a Comment