C++ question
Author | Topic: C++ question |
---|---|
Master
Member # 4614
|
written Wednesday, December 29 2004 12:17
Profile
Homepage
Alright, I'm still a beginner, so keep that in mind. Okay, so I made a Tic-Tac-Toe game, and it seems to work pretty good. The problem is, whenever someone selects a space for their move, the program redraws the board below, with the correct changes made. After a few moves, it starts to look kind of confusing with all the different boards. Is there some way I can just draw the new board on top of the original one each time someone moves so the same board just changes instead of drawing a whole new one. If you know what I mean... :rolleyes: -------------------- -ben4808 For those who love to spam: CSM Forums RIFQ Posts: 3360 | Registered: Friday, June 25 2004 07:00 |
Shock Trooper
Member # 5181
|
written Wednesday, December 29 2004 12:22
Profile
Homepage
In DOS or Windows, you can system() a cls command. Posts: 262 | Registered: Thursday, November 11 2004 08:00 |
By Committee
Member # 4233
|
written Wednesday, December 29 2004 12:50
Profile
I second that. If you're building it with ASCII characters (which I assume to be the case, given you're a beginner), your only option would be to clear the screen and then redraw the table. [ Wednesday, December 29, 2004 12:51: Message edited by: Andrew Miller ] Posts: 2242 | Registered: Saturday, April 10 2004 07:00 |
Master
Member # 4614
|
written Wednesday, December 29 2004 18:36
Profile
Homepage
So just typing system(); will clear the screen for me?And yes, I'm using ASCII characters. Board: :) -------------------- -ben4808 For those who love to spam: CSM Forums RIFQ Posts: 3360 | Registered: Friday, June 25 2004 07:00 |
Warrior
Member # 4238
|
written Wednesday, December 29 2004 19:09
Profile
quote:system("cls"); Or on Unix systems: system("clear"); This is a crappy way to do it, but the easiest. Posts: 70 | Registered: Monday, April 12 2004 07:00 |
Warrior
Member # 4238
|
written Wednesday, December 29 2004 19:12
Profile
You'll also need the stdlib header, BTW. So: Posts: 70 | Registered: Monday, April 12 2004 07:00 |
Master
Member # 4614
|
written Thursday, December 30 2004 11:46
Profile
Homepage
Okay, thanks guys. On my compiler, I have to type to get it to pause anyway. Just doing return 0; doesn't do it. I'll try it out. EDIT: Cool. It works just fine. Two more questions come to mind, though: 1. How can you clear just a portion of the screen? 2. Is there an easy way to have the program respond to a click by the user? [ Thursday, December 30, 2004 11:59: Message edited by: 4614 and 4808 ] -------------------- -ben4808 For those who love to spam: CSM Forums RIFQ Posts: 3360 | Registered: Friday, June 25 2004 07:00 |
Shock Trooper
Member # 5181
|
written Saturday, January 1 2005 15:01
Profile
Homepage
Yes, but you need to make a screen buffer to do it, which still involves clearing the screen in some form or another. Posts: 262 | Registered: Thursday, November 11 2004 08:00 |
Master
Member # 4614
|
written Sunday, January 2 2005 17:26
Profile
Homepage
Huh? -------------------- -ben4808 For those who love to spam: CSM Forums RIFQ Posts: 3360 | Registered: Friday, June 25 2004 07:00 |
Shock Trooper
Member # 5181
|
written Tuesday, January 4 2005 16:11
Profile
Homepage
STFW. It's fairly common. Posts: 262 | Registered: Thursday, November 11 2004 08:00 |