mirror of https://github.com/encounter/SDL.git
Add cursor position to mouse wheel event (thanks @meyraud705!)
Fixes https://github.com/libsdl-org/SDL/pull/6351
This commit is contained in:
parent
5490505a2b
commit
4f318c904a
|
@ -318,6 +318,8 @@ typedef struct SDL_MouseWheelEvent
|
||||||
Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
|
Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
|
||||||
float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */
|
float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */
|
||||||
float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */
|
float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */
|
||||||
|
Sint32 mouse_x; /**< X coordinate, relative to window (added in 2.26.0) */
|
||||||
|
Sint32 mouse_y; /**< Y coordinate, relative to window (added in 2.26.0) */
|
||||||
} SDL_MouseWheelEvent;
|
} SDL_MouseWheelEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -868,6 +868,8 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, S
|
||||||
event.wheel.preciseX = x;
|
event.wheel.preciseX = x;
|
||||||
event.wheel.preciseY = y;
|
event.wheel.preciseY = y;
|
||||||
event.wheel.direction = (Uint32)direction;
|
event.wheel.direction = (Uint32)direction;
|
||||||
|
event.wheel.mouse_x = mouse->x;
|
||||||
|
event.wheel.mouse_y = mouse->y;
|
||||||
posted = (SDL_PushEvent(&event) > 0);
|
posted = (SDL_PushEvent(&event) > 0);
|
||||||
}
|
}
|
||||||
return posted;
|
return posted;
|
||||||
|
|
Loading…
Reference in New Issue