[SDL] SDL_PollEvent()
pixel fairy
pixelfairy at gmail.com
Thu Nov 9 06:00:58 PST 2006
the whole point was making the app light on the cpu. i ended up using
SDL_Delay like this
while(1) {
check_events()
update_state()
draw(backbuffer)
delay()
SDL_GL_SwapBuffer()
}
i think that swapping buffers at frame update time would be
more consistant since the time to draw is more variable, but
it probably doesnt make much differnce. havent tested this yet.
On 11/8/06, David Olofson <david at olofson.net> wrote:
>
> On Friday 03 November 2006 00:55, pixel fairy wrote:
> [...]
> > would making it a poll/select call be bad? or just too much work for
> > the gain? i like to make light apps, that only hit the cpu when they
> > need to by waiting on input until its time to swap buffers.
>
> I think the problem is that many platforms have several different APIs
> that don'tmix when it comes to select() or similar.
>
> What you can do is create separate threads that do the blocking I/O,
> and have these threads communicate with the main thread through a
> single IPC mechanism (like the SDL event system), allowing all
> threads to block properly on their respective APIs.
>
>
> //David Olofson - Programmer, Composer, Open Source Advocate
>
> .------- http://olofson.net - Games, SDL examples -------.
> | http://zeespace.net - 2.5D rendering engine |
> | http://audiality.org - Music/audio engine |
> | http://eel.olofson.net - Real time scripting |
> '-- http://www.reologica.se - Rheology instrumentation --'
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061109/917a69fc/attachment.htm
More information about the SDL
mailing list