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 |
SDL_Delay doesnt seem that bad to me, in your text only tests have you disabled buffered output??? all i can suggest is the functions in time.h and sys/time.h have a look and see if theres anything better but i think SDL_Delay is as good as your gonna get.
|
All times are GMT -5. The time now is 01:01 PM. |