[SDL] What Im doing wrong (Event procesing)

Alejandro Santos alejandrosantos at fibertel.com.ar
Thu Dec 11 07:08:03 PST 2003


At what framerate do you keep your game ? Perhaps the problem is there.
Depending how do you get the input, if you read the events at each frame,
then if you are at a slow frame rate you will notice some lag.

For example: (in pseudocode)

while (run)
{
    while(events_in_queue)
    {
        ReadInput
    }
    Draw
    Delay //for constant framerate
}

If the Delay is too high, there will be a slowdown in the input processing.

I have never used Timers in SDL. Can you send how you did it ?

Byes.
Alejandro.

----- Original Message ----- 
From: <marting at webklan.com>
To: <SDL at libsdl.org>
Sent: Thursday, December 11, 2003 11:18 AM
Subject: [SDL] What Im doing wrong (Event procesing)


                  Hi everyone. Well I read this list since long time ago but
never
sent any msg, so here I am.
I am having some problems with the performance picking up input events
from the keyboard and I dont know what Im doing wrong.
 I have some kind of lag between the moment when I press a key and the
moment when the event is processed. Im working on Windows, I didn't try it
in
linux yet.
Sometimes while the game is runing I have a high response time, and when
the event is worked it has a reaction like if I press the key twice very
fast .
Is a simple app is a tetris.
When I press the rotation key the most of the time it works fine but
sometimes the tetramino rotate twice just like the event stay stucked . I
dont
know if Im beeing clear.
Could you give me some tips about of how to raise the performace?
Im not using opengl, I use HW surfaces and SW surfaces, and use double
buffering when use software. I have de SDL_Event structure in the main. And
I use the sdl timer to keep the frame rate uniform.
If you want more detail just ask.
Thanks

Martin G



_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl






More information about the SDL mailing list