SDL_WaitEvent() & SDL_SetVideoMode()

is it somehow possible to do these two functions in different threads by
using some locking mechanism, or is this impossible by design.

i really want to first spawn an eventloop BEFOR i call SetVideoMode(),
can you think of any dirty hack to make this possible? patching SDL is
no option, btw.

many thx …
clemens–
“Real programmers are not afraid of the goto, but they avoid it whenever
it is possible by writing self modifying code!” (found in c.l.c++)

is it somehow possible to do these two functions in different threads by
using some locking mechanism, or is this impossible by design.

It’s impossible by design. The code in SDL_WaitEvent() drives the event
loop for the window, and on Windows this must be done by the thread which
created the window.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam Lantinga wrote:

is it somehow possible to do these two functions in different
threads by using some locking mechanism, or is this impossible by
design.

It’s impossible by design. The code in SDL_WaitEvent() drives the
event loop for the window, and on Windows this must be done by the
thread which created the window.

ok, thx. do you think it is possible to read the keybord by myself,
bypassing the sdl event handling? i only need keydown events. and the
code does not need to be portable, it just has to work somehow on linux.

best regards …
clemens

ok, thx. do you think it is possible to read the keybord by myself,
bypassing the sdl event handling? i only need keydown events. and the
code does not need to be portable, it just has to work somehow on linux.

Sure, if you’re just using stdin, you can use getch() as long as you set
the terminal mode to character-at-a-time input. This is beyond the scope
of the SDL mailing list though.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam Lantinga wrote:

ok, thx. do you think it is possible to read the keybord by myself,
bypassing the sdl event handling? i only need keydown events. and
the code does not need to be portable, it just has to work somehow
on linux.

Sure, if you’re just using stdin, you can use getch() as long as you
set the terminal mode to character-at-a-time input. This is beyond
the scope of the SDL mailing list though.

good. i will be able to work that out - hopefully! :slight_smile: thanx for your
input.

re …
clemens