Advertisement

question

Started by May 23, 2002 05:45 PM
2 comments, last by jar 22 years, 5 months ago
hey guys! this is a question i''ve had for some time now, so here it goes...i recently finished my tic-tac-toe game(only a two-player game,console mode in c++) and in my program, i have a Draw_Grid() function that would draw the game grid. but i was wondering, how do i make it so i don''t actually have to call this function? i''m not sure if i am making sense, but i think it has something to do with blitting? like, after i call Draw_Grid, i use system("cls"); to clear the screen and wait for the second player''s input, and then call Draw_Grid() again. i was searching around for some info, but i don''t know what to actually search for. any help would be great! thanks!
Read userinput
Clear the screen
Draw screen again

Isn''t that hard...
Advertisement
Generally, you can sum up the main program loop for almost any application as:

Input(); // read the player(s) input
Process(); // update the game world based upon that input
Output(); // draw the screen

in Output(); simply clear the screen at the beginning and then redraw your grid. Easy.

i knew this question would sound stupid. i just figured that you could somehow set the background to always be the same, and then just update it when you needed to. and thanks for the responses!

This topic is closed to new replies.

Advertisement