Well, if it’s actually too slow (ie insufficient frame rate to look
good), all you can do is check your display settings, surfaces
formats etc; the usual performance tweaking stuff. If all else fails,
try glSDL or native OpenGL rendering.
However, I suspect your problem is that you can’t keep up with the
rate of the mouse motion events, so they queue up, and you get that
nice rubber band delay feel.
What you do about that is simply make sure you empty the event queue
once per rendered frame. That is;
while(running)
{
while(there_are_events)
process_event();
render();
SDL_Flip();
}
Obviously, this implies that you do not repaint the screen as a direct
effect of processing any events! Only update variables and stuff
until you have nothing more to do, then refresh the display.
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
— http://olofson.net — http://www.reologica.se —On Monday 22 September 2003 16.47, Andre’ Wagner wrote:
Hello,
I need a stategic advice.
I’m writing this game seen from above (like Warcraft). I want that,
when user presses the right button mouse and drags it, the map
moves with it. (if anyone ever played Transport Tycoon, it’s
exactly like this).
I’m doing something like this: a big map surface, and the screen
surface. So when the event mousemove happens (with the right button
pressed), the part of the map is blitted on the screen. But the
problem is that it’s too slow!
So how could I do that? Maybe with a thread? Any advice would be
apreciated!