Archived

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

Ragadast

Hiding Console Cursor

Recommended Posts

Is there a way to hide the Consolo Cursor in C++? I'm trying to graphic some ASCII maps and try to use some basic AI, but the cursor appears every each place I want to cout something. Here's a part of the code:
        
HANDLE hOut;
char map[80][25];
map[2][2] = 'X';
COORD position;

hOut = GetStdHandle(STD_OUTPUT_HANDLE);

for(int i=0; i<80; i++)
{
    for(int e=0; e<25; e++)
    {
         position.X = i;
         position.Y = e;
       
         SetConsoloCursorPosition(hOut, position);
         cout << map[i][e];
    }
}
        
[edited by - Ragadast on June 6, 2002 10:10:16 PM]

Share this post


Link to post
Share on other sites
Well, if you''re using Borland (Which I think you''re not) use:

_setcursortype( _NOCURSOR );


or _SOLIDCURSOR or _NORMALCURSOR

From the Borland Turbo C++ User''s Guide, Page 610. Chapter 20, Video Functions. (Hopefully, this can help you with the MS Stuff)

Share this post


Link to post
Share on other sites
Now I don''t exactly know how to do this; but if you''re trying to output ascii characters you could just enter graphics mode and reference the ASCII characters from memory from within the graphics mode. Andre La Mothe references this in his "Tricks of the 2D Games Programming Gurus" or "The Black Art of 3D Game Programming" books - I forget which one exactly.

Then you don''t need to worry about switching back and forth from different video modes and you have a character set all ready for your game. Of course, the characters are all Courier font, I think.

Share this post


Link to post
Share on other sites
I''m doing it under VC++. I tried the ShowCursor() but i think that one is for the mouse cursor, or am i wrong? Well, anyway, it still shows the "_" cursor while it moves through each space in the screen. Thanks for the ones who already answered

Share this post


Link to post
Share on other sites
You want the win32 API function:

SetConsoleCursorInfo()

MSDN library is your friend.

also check out the many other console functions - such as setting the console window title, size, using colors, and much more.

Share this post


Link to post
Share on other sites
Hey, I just finised a game using just the console and bunch of ascii characters. Its a good way to learn stuff without getting boggled down with too much info.

Here is the link to all the console functions in MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/conchar_3vg3.asp


I forgot who gave the link but that was one awesome link. Its got all you need to do anything in the console. Good luck!

Share this post


Link to post
Share on other sites