Number of mouse buttons

Hi guys

I know that there’s no way in current SDL API to get:

  • number of mouse buttons
  • info about existance of mouse wheels

Well, there has been thread about what new things to add in incoming SDL versions; so I’d like to submit a proposal of adding one new function and type:

void SDL_GetMouseInfo( SDL_MouseInfo * caps);

struct SDL_MouseInfo
{
int buttons; // number of mouse buttons, + maybe special value (-1) when there’s no mouse available?
int wheels; // number of mouse wheels, there are mices without them, with one wheel, two wheels; I’ve not heard of more wheels in mouse

// other things? probably not
};

Of course, this could be implemented in this form, (or more likely) in other, which would fit better into planned multiple mice system. What’s important is to have a way of querying for aforementioned values.

Pardon me if it’s impossible to add this because of sth, probably lack of portability - since there’s no mouse in handhelds or other platforms like Dreamcast… but, hmmm, in this situation, why there are available other mouse functions? or keyboard? IMHO, adding one function (+ type) wouldn’t bloat SDL very much.

Anyway, I had to write about it to have peace of mind :-)–
Koshmaar
<Of all the things I’'ve lost, I miss my mind the most>
GG: 3928072
http://jnr.sourceforge.net/
www.pongowar.prv.pl

Yes, I think this is a good idea. This would characterise Mac OS X’s
shift-scroll wheel functionality perfectly.On 24 Mar 2005, at 19:27, Koshmaar wrote:

Hi guys

I know that there’s no way in current SDL API to get:

  • number of mouse buttons
  • info about existance of mouse wheels

Well, there has been thread about what new things to add in incoming
SDL versions; so I’d like to submit a proposal of adding one new
function and type:

void SDL_GetMouseInfo( SDL_MouseInfo * caps);

struct SDL_MouseInfo
{
int buttons; // number of mouse buttons, + maybe special value
(-1) when there’s no mouse available?
int wheels; // number of mouse wheels, there are mices without
them, with one wheel, two wheels; I’ve not heard of more wheels in
mouse

// other things? probably not
};

Of course, this could be implemented in this form, (or more likely) in
other, which would fit better into planned multiple mice system.
What’s important is to have a way of querying for aforementioned
values.

Pardon me if it’s impossible to add this because of sth, probably lack
of portability - since there’s no mouse in handhelds or other
platforms like Dreamcast… but, hmmm, in this situation, why there
are available other mouse functions? or keyboard? IMHO, adding one
function (+ type) wouldn’t bloat SDL very much.

Anyway, I had to write about it to have peace of mind :slight_smile:


Koshmaar
<Of all the things I’'ve lost, I miss my mind the most>
GG: 3928072
http://jnr.sourceforge.net/
www.pongowar.prv.pl


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

Actually the Dreamcast does have a mouse :)On Thu, 24 Mar 2005 20:27:55 +0100, Koshmaar wrote:

Pardon me if it’s impossible to add this because of sth, probably lack of portability - since there’s no mouse in handhelds or other platforms like Dreamcast… […]

probably lack of portability - since there’s no mouse in handhelds

Doing something like this would require a query for “number of mice
available”, since even on a mouse-driven system like Windows or MacOS,
you might just not have a mouse plugged in at the moment, so it’s not a
question of portability in that sense.

However, (and I honestly don’t know), how many systems supply this
information? Can you query the capabilities of the mouse on
X11/Windows/Mac/BeOS, etc, or do you just have to wait and see what
buttons the user clicks?

In my experience, most Windows games assume you have 3 buttons and a
mousewheel minimum, which causes a huge fuss when you do a mac port and
very likely have one button, period. I’ve never seen any game (SDL or
otherwise) query the mouse capabilities, though, even if it’s possible
to do so.

–ryan.

probably lack of portability - since there’s no mouse in handhelds

Doing something like this would require a query for “number of mice
available”, since even on a mouse-driven system like Windows or MacOS,
you might just not have a mouse plugged in at the moment, so it’s not a
question of portability in that sense.

IIRC, in the beginning of my SDL mailing list activity, I read some messages from people who written that they can’t force SDL to work on some exotic mice-less devices - and they were pretty sure that the problem was in that SDL wasn’t working because there’s no mouse attached - SDL_Init() don’t work or sth like that.
So, if they were right, we can assume that if SDL_Init() passed, there’s at least one mouse attached.

But, that’s not very good - IMHO, if there aren’t any low level or portability problems with code, it would be much better if next generation of SDL (probably 2.0) could be able to work with any number of mice: from 0 to hardware/software max, and to give programmer easy way to query for the mouse count. So some time ago I thought, that due to planned new (multi) mouse architecture, by the way we could and add new query function, that would be connected with actual SDL API tendentions (that is - more flexibility / generality, less limitations).

However, (and I honestly don’t know), how many systems supply this
information? Can you query the capabilities of the mouse on
X11/Windows/Mac/BeOS, etc, or do you just have to wait and see what
buttons the user clicks?

Sorry, I also really don’t know about this kind of existing API, but I’m almost sure that DirectX (which can handle multiple mices) guarantee access to this information. Well, I hope someone on this list knows sth about it, and will share his/hers knowledge with us :slight_smile:

In my experience, most Windows games assume you have 3 buttons and a
mousewheel minimum, which causes a huge fuss when you do a mac port and
very likely have one button, period. I’ve never seen any game (SDL or
otherwise) query the mouse capabilities, though, even if it’s possible
to do so.

In my experience, most games assume nothing about your mouse :slight_smile: and I’m thinking about input processing - they just set some default keys and (most often) LMB, which are responsible for some in-game actions, and if you want to change those, just select one and press new key / button - and well, if your mouse don’t have ie. middle button then there’s no worry that you will select it ie. as attack action :slight_smile:

Koshmaar

So, if they were right, we can assume that if SDL_Init() passed,
there’s at least one mouse attached.

They might be right in 1.2.8, but really, that’s a bug in the library
and needs fixing pre-2.0, in my opinion.

It’s likely trivial to fix. Does anyone have info on this?

–ryan.

So, if they were right, we can assume that if SDL_Init() passed,
there’s at least one mouse attached.

They might be right in 1.2.8, but really, that’s a bug in the library
and needs fixing pre-2.0, in my opinion.

It’s likely trivial to fix. Does anyone have info on this?

As far as I know, SDL doesn’t internally assume there are any mice.
Specific drivers might, though.

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