Clearing the screen?

Discuss all aspects of programming here.

Moderator: The Mod Squad

Post Reply
User avatar
Snowfire
Black Belt 1st Degree
Black Belt 1st Degree
Posts: 1486
Joined: Sun May 11, 2003 8:47 pm
Location: Omaha, NE

Clearing the screen?

Post by Snowfire »

Hello all, I was just wondering how I would go about clearing the screen in C++. I'm using Microsoft Visual C++ v6.0, and using a C++ Source file. I haven't yet learned how to program a Win32API yet, so hopefully that info helps you determine what would be best. I am basically trying to make a Text-Based RPG sort of like Materia Magica, but a single player version. Right now I'm trying to clear the screen after displaying the main menu and letting the user make their choice. I'm trying to take this step by step really. Once the user get's into the actual game, I'm trying to display the area and the player's info (Health, Stamina, and later I'll add in Spell Points) and then let them make their choice. We'll, I think that I've given enough info to get you started. If you've played the game, shout out some suggestions for how to do certain things. If you haven't played it, CHECK IT OUT! It is so much fun, and then you would be able to help out. In fact, if some people made some classes for certain functions, than we could all work on it. Well, have at it! :twisted:
Tono Sien


Love is the greatest conspiracy, by the most loving genius.
Roach412
Black Belt 2nd Degree
Black Belt 2nd Degree
Posts: 2760
Joined: Mon Aug 09, 2004 7:33 pm
Location: Milwaukee - Wisconsin

Post by Roach412 »

this shows a way of creating your own little clearscreen function.

http://cpp.enisoc.com/articles/clrscr/

unless you are using the Borland-type C++ compiler, there's no built-in clearscrean.

-Roach
Lian Li Lancool First Knight Series PC-K59W
Intel Core i7-960 Bloomfield 3.2GHz
EVGA X58 FTW3 132-GT-E768-TR
EVGA GeForce GTX 1070 FTW GAMING ACX 3.0
G.SKILL Ripjaws Series 12GB (3 x 4GB)
Crucial M4 128gb SATAIII SSD x2
Crucial M4 256gb SATAIII SSD
OCZ Saber 1000 960GB Enterprise SSD
Corsair Professional Series HX850 PSU
Dell UltraSharp U2713HM 27" w/drop ceiling mount
Logitech G930 7.1 Headset
DBPOWER RGB LED Keyboard
Logitech G402 Hyperion Fury
User avatar
Snowfire
Black Belt 1st Degree
Black Belt 1st Degree
Posts: 1486
Joined: Sun May 11, 2003 8:47 pm
Location: Omaha, NE

Post by Snowfire »

Alrighty, got it to work with the system("cls"), now I'm just trying to get this to compile without any errors and try to move on.
Tono Sien


Love is the greatest conspiracy, by the most loving genius.
adrianxw
Initiate
Initiate
Posts: 53
Joined: Tue Jan 27, 2004 1:52 pm
Location: Denmark

Post by adrianxw »

The system() function is a poor choice for Windows, it has a real performance hit which can mount up if you use it often.

You may be interested in my 6 part console programming tutorial. It uses API routines starts slowly but gets into some quite sophisticated techniques. Clearing the screen is covered in part 2.

http://www.adrianxw.dk/SoftwareSite/Con ... oles1.html
[i][color=blue]Wave upon wave of demented avengers march cheerfully out of obscurity into the dream.[/color][/i]
netaces2k

Post by netaces2k »

a simple way to clear the screen is to call the ANSI handler. and pass an ESC[2J to the handler at the point you want the screen cleared.
User avatar
Snowfire
Black Belt 1st Degree
Black Belt 1st Degree
Posts: 1486
Joined: Sun May 11, 2003 8:47 pm
Location: Omaha, NE

Post by Snowfire »

Dear lord man! That was half a year ago! I passed with flying colors! Not to mention I kinda surpassed the knowledge of my teacher in some areas! :oops:

Now though, I'm sorting through the source for Quake 3, and am thinking about doing a total conversion with the source... Either way, I'm gonna have some fun!
Tono Sien


Love is the greatest conspiracy, by the most loving genius.
User avatar
DAVE1
Mobo-fu Master
Mobo-fu Master
Posts: 7699
Joined: Sat May 14, 2005 11:49 am
Contact:

Post by DAVE1 »

what class is this that your doing all of this?
Join team 33258 today!!
User avatar
Snowfire
Black Belt 1st Degree
Black Belt 1st Degree
Posts: 1486
Joined: Sun May 11, 2003 8:47 pm
Location: Omaha, NE

Post by Snowfire »

Well I WAS taking a C++ class last school year, but now I'm not taking a class for programming. I am hoewever doing an independent study course on 3D modeling and animation using Maya and 3Ds Max... I'm hoping to incorporate the two classes over the summer with my buddies and either complete a mod, or do a total conversion...
Tono Sien


Love is the greatest conspiracy, by the most loving genius.
Post Reply