Joystick events only generated when SDL_INIT_VIDEO used

Hi all,
Just wondering why the Joystick events/state can’t be accessed
without video having been initialised?

This generates Joystick events…
SDL_Init( SDL_INIT_JOYSTICK or SDL_INIT_VIDEO);
joystick = SDL_JoystickOpen(0);

but this does not…
SDL_Init( SDL_INIT_JOYSTICK );
joystick := SDL_JoystickOpen(0);

Any ideas?

Hi all,
I know I seemed to have started a religious war about the PS3, but I
was actually hoping someone would answer this earlier question…

Dominique Louis wrote:> Hi all,

Just wondering why the Joystick events/state can’t be accessed without
video having been initialised?

This generates Joystick events…
SDL_Init( SDL_INIT_JOYSTICK or SDL_INIT_VIDEO);
joystick = SDL_JoystickOpen(0);

but this does not…
SDL_Init( SDL_INIT_JOYSTICK );
joystick := SDL_JoystickOpen(0);

Any ideas?

Hi all,
I know I seemed to have started a religious war about the PS3, but I
was actually hoping someone would answer this earlier question…

Dominique Louis wrote:

Hi all,
Just wondering why the Joystick events/state can’t be accessed without
video having been initialised?

This generates Joystick events…
SDL_Init( SDL_INIT_JOYSTICK or SDL_INIT_VIDEO);
joystick = SDL_JoystickOpen(0);

but this does not…
SDL_Init( SDL_INIT_JOYSTICK );
joystick := SDL_JoystickOpen(0);

Any ideas?

This is because SDL_INIT_VIDEO also initlizes the event system. Why?
Because on all mayor systems (Windows/MaxOSX/*nix with X11) your
application need an active window to get this information from the OS in
the first place.On Tue, 4 Apr 2006, Dominique Louis wrote:

Hi all,
I know I seemed to have started a religious war about the PS3,
but I
was actually hoping someone would answer this earlier question…

Dominique Louis wrote:

Hi all,
Just wondering why the Joystick events/state can’t be accessed
without
video having been initialised?

This generates Joystick events…
SDL_Init( SDL_INIT_JOYSTICK or SDL_INIT_VIDEO);
joystick = SDL_JoystickOpen(0);

but this does not…
SDL_Init( SDL_INIT_JOYSTICK );
joystick := SDL_JoystickOpen(0);

Any ideas?

This is because SDL_INIT_VIDEO also initlizes the event system.

Yes.

Why?
Because on all mayor systems (Windows/MaxOSX/*nix with X11) your
application need an active window to get this information from the
OS in
the first place.

This is not true.

SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) wont create a window,
on those platforms. Also, SDL’s joystick subsystem can be accessed
from the console on those platforms, without creating a window (but
you have to specify SDL_INIT_VIDEO, and subvert SDL’s private main()
function, which actually creates the window).

spencerOn Apr 5, 2006, at 3:57 AM, Mattias Karlsson wrote:

On Tue, 4 Apr 2006, Dominique Louis wrote:

Hi all,
Just wondering why the Joystick events/state can’t be accessed
without video having been initialised?

This generates Joystick events…
SDL_Init( SDL_INIT_JOYSTICK or SDL_INIT_VIDEO);
joystick = SDL_JoystickOpen(0);

but this does not…
SDL_Init( SDL_INIT_JOYSTICK );
joystick := SDL_JoystickOpen(0);

Any ideas?

I’ve been spending a lot of time mucking about in that code in SDL and
what I have seen is that there is a lot of initialization done in the
video code that has to be done to start SDL working correctly whether
you ever create a window or not. On X, for instance, the connection to
the server is created during video initialization, and you have to have
that connection to get keyboard and mouse input.

The answer really is that SDL was just written that way. The idea was to
write a game development library and games do graphics. SDL is being
used as a generic multimedia library and seems to be slowly being driven
in that direction, but it is still a game development library.

I believe that your real question is something like, who do I get
joystick input without creating a window. I don’t know the answer for
sure, but I would suggest trying the dummy video driver. It will not
create a window or initialize graphics in anyway, but it may allow you
to access the joysticks. I haven’t tried it my self, so I do not know it
if will work. Give it a try and let us know.

	Bob PendletonOn Sat, 2006-04-01 at 18:26 +0100, Dominique Louis wrote:

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


±-------------------------------------+