countdown and splash screen
i'm working on a c++ clone of tetris using SDL and i'm having a bit of trouble with a few things.
the first is a timer for the block movement. i've written a game loop that runs as long as the game isn't quit. first it checks for input ( move, drop, or rotate the block ) and acts on the input, then it drops the block normally, and then updates the screen. the only problem is, i can't seem to get a good timer. SDL_Delay is finiky at best. i've tried several different things in a text-only test ( prints "Dropping..." every few seconds) but nothing seems to give me a good timed event. any suggestions?
the second problem is splash screens. this is what i have tried for displaying a splash screen:
int i = 6000;
while (i > 3000) {
DrawSceneOne();
i++;
}
while (i > 0) {
DrawSceneTwo();
i++;
}
if (i == 0) {
DrawSceneThree();
}
where DrawSceneOne() displays the first splash/logo screen, DrawSceneTwo() displays the second splash/logo screen and DrawSceneThree shows the normal playing field while waiting for the player to press f1 to begin a new game. any help on either of these two prolems much appreciated.
thanks,
rebelcan
|