Jump to content
  • Advertisement

Archived

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

sAlFace

Console window stuff

This topic is 5464 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

Can you change the default text color in the console window? How about alternate colors? Can you erase text once it has been output?

Share this post


Link to post
Share on other sites
Advertisement
try looking at <conio.h>


u r what u bcome

[edited by - bcome on November 7, 2003 10:09:17 PM]

Share this post


Link to post
Share on other sites
Alright, conio.h will not help you then.


#include <windows.h>

void setcolor(WORD color) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}

void gotoxy(SHORT x, SHORT y) {
COORD p = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), p);
}


Use setcolor() to change the default text color. Use gotoxy() to move to a location on the console screen buffer. To erase, simply write spaces or what have you.


Colin Jeanne | Invader's Realm

[edited by - Invader X on November 7, 2003 12:28:40 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Invader X
Alright, conio.h will not help you then.

....


What do you mean conio.h won''t help I have it under C++ .NET

Share this post


Link to post
Share on other sites
Look up "Console Functions" in the Win32 reference guide. (eg CreateConsoleScreenBuffer, SetConsoleTitle, GetConsoleCursorInfo etc.) If you find the Console Functions section.. they''ll all be there .

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!