FS#131 - Add mouse position to the sf::Event::MouseWheelMoved event

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1249 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-10-27 15:56:16 +00:00
parent 0d66fa1776
commit 688a8f15da
9 changed files with 32 additions and 4 deletions

View File

@ -242,6 +242,8 @@ struct sfMouseWheelEvent
{
sfEventType Type;
int Delta;
int X;
int Y;
};
////////////////////////////////////////////////////////////

View File

@ -62,6 +62,8 @@ inline void ConvertEvent(const sf::Event& SFMLEvent, sfEvent* event)
case sfEvtMouseWheelMoved :
event->MouseWheel.Delta = SFMLEvent.MouseWheel.Delta;
event->MouseWheel.X = SFMLEvent.MouseWheel.X;
event->MouseWheel.Y = SFMLEvent.MouseWheel.Y;
break;
case sfEvtMouseButtonPressed :

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -294,6 +294,12 @@ namespace SFML
{
/// <summary>Scroll amount</summary>
public int Delta;
/// <summary>X coordinate of the mouse cursor</summary>
public int X;
/// <summary>Y coordinate of the mouse cursor</summary>
public int Y;
}
////////////////////////////////////////////////////////////

View File

@ -132,10 +132,18 @@ namespace SFML
public MouseWheelEventArgs(MouseWheelEvent e)
{
Delta = e.Delta;
X = e.X;
Y = e.Y;
}
/// <summary>Scroll amount</summary>
public int Delta;
/// <summary>X coordinate of the mouse cursor</summary>
public int X;
/// <summary>Y coordinate of the mouse cursor</summary>
public int Y;
}
////////////////////////////////////////////////////////////

View File

@ -223,8 +223,8 @@ public :
////////////////////////////////////////////////////////////
struct MouseMoveEvent
{
int X; ///< X position of the mouse, relative to the left of the owner window
int Y; ///< Y position of the mouse, relative to the top of the owner window
int X; ///< X position of the mouse pointer, relative to the left of the owner window
int Y; ///< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@ -235,8 +235,8 @@ public :
struct MouseButtonEvent
{
Mouse::Button Button; ///< Code of the button that has been pressed
int X; ///< X position of the mouse, relative to the left of the owner window
int Y; ///< Y position of the mouse, relative to the top of the owner window
int X; ///< X position of the mouse pointer, relative to the left of the owner window
int Y; ///< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@ -246,6 +246,8 @@ public :
struct MouseWheelEvent
{
int Delta; ///< Number of ticks the wheel has moved (positive is up, negative is down)
int X; ///< X position of the mouse pointer, relative to the left of the owner window
int Y; ///< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////

View File

@ -532,9 +532,17 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
// Mouse wheel event
case WM_MOUSEWHEEL :
{
// Mouse position is in screen coordinates, convert it to window coordinates
POINT position;
position.x = LOWORD(lParam);
position.y = HIWORD(lParam);
ScreenToClient(myHandle, &position);
Event event;
event.Type = Event::MouseWheelMoved;
event.MouseWheel.Delta = static_cast<Int16>(HIWORD(wParam)) / 120;
event.MouseButton.X = position.x;
event.MouseButton.Y = position.y;
SendEvent(event);
break;
}