LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2003, 05:55 PM   #1
rebelcan
Member
 
Registered: Jun 2003
Location: British Columbia, Canada
Distribution: Debian unstable
Posts: 83

Rep: Reputation: 15
Unhappy 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
 
Old 07-31-2003, 06:23 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating kde splash screen boot screen JUDOLIZARD Linux - Newbie 6 01-30-2009 12:32 PM
Splash Screen dimension8300 SUSE / openSUSE 5 02-20-2005 03:40 PM
Splash screen - What?? Micro420 Mandriva 5 09-07-2003 03:36 PM
splash screen snocked Linux - Newbie 1 01-12-2003 12:43 PM
splash screen BG elmetald00d Linux - Newbie 4 03-28-2002 02:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration