Refresh c++
Hi, I have made a small game of tic tac toe which I want to refresh so it changes. How would I do this?
You want to write a function that draws your gamestate, and call that after everytime you clear the screen.
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);
}
}
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.
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
Popular Topics
Advertisement