Refresh c++

Started by
7 comments, last by Emmanuel Deloget 18 years, 10 months ago
Hi, I have made a small game of tic tac toe which I want to refresh so it changes. How would I do this?
Advertisement
system("cls");

but you must redraw after that because it clears the screen
Thanks. Could I make it so it redraws everything itself?
You want to write a function that draws your gamestate, and call that after everytime you clear the screen.
----------------------------------------------------------No matter how eloquently you state your argument, the fact remains that the toilet seat is a bistable device. Therefore it's natural position is no more down than it is up.[SDL Smooth Tile Scrolling]
Could you tell me how to write a function please?
Are you using Java or C/C++? How much programming do you know? You would just pass the information of the squares to a drawing function which would then draw the squares and mark the appropriate Xs or Os.
In short (I can't believe I'm doing this):

here is an example:

[/source]
void DrawTheBoard(TicTacToeBoard board)
{
system("cls");
//Do the drawing procedure here
}

int main()
{
TicTacToeBoard board;
while(game)
{
//User input stuff
DrawTheBoard(board);
}
}
If you don't know how to write a function, you really need to read up more.  Check out the GDnet store - look for books by Addison-Wesley, a publisher with a good reputation.
my siteGenius is 1% inspiration and 99% perspiration
Quote:Original post by Yhack
Could you tell me how to write a function please?


clicky
Quote:Original post by Yhack
Could you tell me how to write a function please?


This question shows that you don't really know wht a C++ function is, because it shows that you didn't notice that main() is a function.

I believe you should find a small book about C or C++; you might also check the web for more information. cprogramming has rather simple C++ tutorials that might help you.

HTH,

(icks. too slow)

This topic is closed to new replies.

Advertisement