[SDL] SDL + OpenGL + Win98
Mark Jenison
jenison at enteract.com
Sat Sep 29 10:49:13 PDT 2007
Brian <brian.ripoff <at> gmail.com> writes:
>
> How do you handle events? Remember to regularly (ideally once a frame)
> clear the SDL event queue. I believe what might be happening is that
> the OS is trying to send events to your program but your program can
> no longer respond to them as you do not handle them fast enough. That
> is just a guess though.
for the input startup, I do this:
SDL_EnableUnicode(1);
if (SDL_NumJoysticks())
{
SDL_JoystickEventState(SDL_IGNORE);
joystick = SDL_JoystickOpen(0);
}
The program runs in a tight loop
while (!finished)
{
update sounds
if (ready)
drawScreen()
while (framecount > 0)
{
advance_frame();
handle_events();
handle_input_state();
updateScreen();
--frame_count;
}
}
In the handle_events:
while (SDL_PollEvent(&event)
{
// check event types
switch(event.type)
{
// check keyboard events, videoresize
}
}
So I think everything is being handled frequently enough...any tips on how to
verify that this may be the issue?
One I should mention is the WinXP environment doesn't have a joystick
connected...so maybe the Joystick routines are causing an issue?
--
Mark Jenison
More information about the SDL
mailing list