[SDL] Number of mouse buttons

Koshmaar koshmaar at poczta.onet.pl
Fri Mar 25 06:33:37 PST 2005


> > 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 :-)

 
> 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 :-) 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 :-)


Koshmaar




More information about the SDL mailing list