[SDL] WheelMouse Wheel (up&down) Input Events
Romi Kuntsman
romik12345 at lycos.co.uk
Sat Jun 1 03:39:01 PDT 2002
Lee Dohm wrote:
>Thanks for the info! I have only just begun working with the SDL, but
>have already noticed a number of discrepancies between the documentation
>and the code. (I'm compiling them as I go, so I can submit them to
>whomever is handling documentation along the way.)
>
That's what I just did... :)
>>After some experimenting, I've found out that when the wheel moves up
>>and down, I recieve a SDL_MOUSEBUTTONDOWN event with 4 (wheel up) and 5
>>(wheel down) as the button index (event.state).
>>
>>In the documentation it's said: "The mouse button index
>>(SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT)", no mention of
>>wheel... :(
>>
>>
>
>Ok ... I'm using the version tagged "release_1_2_4" from CVS ... so my
>mileage may be varying here ... but I did some quick tests to confirm.
>
I only use binaries, but did check the latest CVS and saw there's no
sign of wheel mouse.
>Platform:
>WinXP Pro
>
Me too...
>I figured that it would be incongruous for SDL to only be receiving
>mouse button down events without mouse button up events, so I trapped
>both in my test. For each tick of the mouse wheel, I got one
>SDL_MOUSEBUTTONDOWN followed immediately by an SDL_MOUSEBUTTONUP event.
>
>Wheel Up:
>SDL_MOUSEBUTTONDOWN
>event.button.button = 4
>event.button.state = 1 (I assume this is for simply testing true/false
>"is the button down?"
>
>SDL_MOUSEBUTTONUP
>event.button.button = 4
>event.button.state = 0
>
>
>Wheel Down:
>SDL_MOUSEBUTTONDOWN
>event.button.button = 5
>event.button.state = 1
>
>SDL_MOUSEBUTTONUP
>event.button.button = 5
>event.button.state = 0
>
Are you sure about that?
Because I got 4 and 5 in event.button.state, and this is what's written
in my documentation (from JEDI-SDL, Delphi structure):
TSDL_MouseButtonEvent = record
type_: UInt8; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
which: UInt8; // The mouse device index
state: UInt8; // The mouse button index
button: UInt8; // SDL_PRESSED or SDL_RELEASED
x: UInt16; // The X coordinates of the mouse at press time
y: UInt16; // The Y coordinates of the mouse at press time
end;
Wait a minute! I just notices the "state" and "button" are in reverse
order in the original header (ok, the correct order, and the reverse
order in mine) :
typedef struct {
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
Uint8 which; /* The mouse device index */
Uint8 button; /* The mouse button index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
Uint16 x, y; /* The X/Y coordinates of the mouse at press
time */
} SDL_MouseButtonEvent;
Damm! My Delphi translation of the header (JEDI-SDL) is wrong!!!
AAAAaaaaaahhhhh!!!!! :((((
Any other JEDI-SDL users on the list?
RK.
More information about the SDL
mailing list