I have this as my game loop (WIn32 VC++5), but the performance is horribly
slow. Do I need to use the events, as I (ultimately!) want a nice tight
main loop which blits, checks the keys and checks the mouse. Am I doing
something wrong?
I have this as my game loop (WIn32 VC++5), but the performance is horribly
slow. Do I need to use the events, as I (ultimately!) want a nice tight
main loop which blits, checks the keys and checks the mouse. Am I doing
something wrong?
I have to go eat, but in general this is going to be a relatively slow loop,
because you are doing a triple table lookup and are probably blitting in
software.
Here are some general optimization tricks that might help this particular
loop:
I have this as my game loop (WIn32 VC++5), but the performance is horribly
slow. Do I need to use the events, as I (ultimately!) want a nice tight
main loop which blits, checks the keys and checks the mouse. Am I doing
something wrong?
I have to go eat, but in general this is going to be a relatively slow loop,
because you are doing a triple table lookup and are probably blitting in
software.
Here are some general optimization tricks that might help this particular
loop:
thanks, this helps me a lot too … although my K6-300 under Linux can
probably optimize it itself with -O6 -mamdk6… egcs automatically unrolls
loops and all.
I’ll have Richard send you a 3.0.1 boxed set when it comes out. It’s got
Maelstrom and SDL on it, plus egcs and gcc 2.7.2.3, plus a bunch of other
neat stuff.
You’re still in Pleasanton, CA, right? I’ll probably be back for good
next month or the month after, and I’ll be living in that area. We should
get together and have lunch or something.On Tue, 24 Nov 1998, Sam Lantinga wrote:
Scott M. Stone <sstone at pht.com, sstone at pht.co.jp>
Head of TurboLinux Development/Systems Administrator
Pacific HiTech, Inc (USA) / Pacific HiTech, KK (Japan)
You might want to move the SDL_PollEvent() loop before the keystate check
because the SDL_PollEvent() function updates the current keystate.
Your application will have better keyboard response that way.
Good day,
Developers. Sorry for this off topic question, but this is so new to
me (sdl, game developing, … ):
I have a crazy idea to put 3 games in 1. So each have it's own game
loop. Now, I have a menu trough witch user can start game1, game2 or
game3 with its own loop. So I think that i should call menu loop from
main loop, and when user selects one of the games, I should call game
loop. Correct, or am I brain dead?
// this is in main - int main( int argc, char *argv[] ) func (main
loop), calls menu loop
int done = 0; // exit from app when done == 10; 1 for game1, 2 for
game2, 3 for game3, 10 for exit
while ( done != 10 )
{
if ( done == 0 )
done = showMainMenu(); // main menu loop returns 1, 2 or 3 if
games are selected, or 10 for exit
if ( done == 1 )
done = startGame1(); // game1 loop returns 0 when loop exits
if ( done == 2 )
done = startGame2(); // game2 loop returns 0 when loop exits
if ( done == 3 )
done == startGame3(); // game3 loop returns 0 when loop exits
}
// main menu loop
int showMainMenu()
{
// start while loop for menu and then...
// if user selected game1...
return 1;
// if user selected game2...
return 2;
// if user selected game3...
return 3;
// if user selected exit...
return 10;
}
// game1 loop
int game1()
{
// start while loop for game1 and then...
// if user selected exit...
return 0;
}
... is this OK?
Thanks for help,
Vladimir.--
done = startGame2(); // game2 loop returns 0 when loop exits
if ( done == 3 )
done == startGame3(); // game3 loop returns 0 when loop exits
Watch for this typo, it’ll still call startGame3(), but wont set done to the
value returned; it’d do a comparison as you know, and go back to running the
same game again.
done = startGame2(); // game2 loop returns 0 when loop exits
if ( done == 3 )
done == startGame3(); // game3 loop returns 0 when loop exits
Watch for this typo, it’ll still call startGame3(), but wont set done
to the value returned; it’d do a comparison as you know, and go back
to running the same game again.
Cheers,
John
Thanks John:)–
"This is it… This is where I belong… "