Fixed negative mouse coordinates being returned as unsigned integers on Windows

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1522 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-05-25 17:44:12 +00:00
parent d48c7ff18c
commit 52f8da466c
5 changed files with 22 additions and 21 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -45,7 +45,8 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="OpenGL.cs" /> <Compile Include="OpenGL.cs">
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Tao.FreeGlut, Version=2.4.0.2, Culture=neutral, PublicKeyToken=6e602a6ad6c0d06d, processorArchitecture=MSIL"> <Reference Include="Tao.FreeGlut, Version=2.4.0.2, Culture=neutral, PublicKeyToken=6e602a6ad6c0d06d, processorArchitecture=MSIL">

View File

@ -522,8 +522,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
{ {
// Mouse position is in screen coordinates, convert it to window coordinates // Mouse position is in screen coordinates, convert it to window coordinates
POINT position; POINT position;
position.x = LOWORD(lParam); position.x = static_cast<Int16>(LOWORD(lParam));
position.y = HIWORD(lParam); position.y = static_cast<Int16>(HIWORD(lParam));
ScreenToClient(myHandle, &position); ScreenToClient(myHandle, &position);
Event event; Event event;
@ -541,8 +541,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonPressed; event.Type = Event::MouseButtonPressed;
event.MouseButton.Button = Mouse::Left; event.MouseButton.Button = Mouse::Left;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -553,8 +553,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonReleased; event.Type = Event::MouseButtonReleased;
event.MouseButton.Button = Mouse::Left; event.MouseButton.Button = Mouse::Left;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -565,8 +565,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonPressed; event.Type = Event::MouseButtonPressed;
event.MouseButton.Button = Mouse::Right; event.MouseButton.Button = Mouse::Right;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -577,8 +577,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonReleased; event.Type = Event::MouseButtonReleased;
event.MouseButton.Button = Mouse::Right; event.MouseButton.Button = Mouse::Right;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -589,8 +589,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonPressed; event.Type = Event::MouseButtonPressed;
event.MouseButton.Button = Mouse::Middle; event.MouseButton.Button = Mouse::Middle;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -601,8 +601,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonReleased; event.Type = Event::MouseButtonReleased;
event.MouseButton.Button = Mouse::Middle; event.MouseButton.Button = Mouse::Middle;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -613,8 +613,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonPressed; event.Type = Event::MouseButtonPressed;
event.MouseButton.Button = HIWORD(wParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; event.MouseButton.Button = HIWORD(wParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -625,8 +625,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseButtonReleased; event.Type = Event::MouseButtonReleased;
event.MouseButton.Button = HIWORD(wParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; event.MouseButton.Button = HIWORD(wParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2;
event.MouseButton.X = LOWORD(lParam); event.MouseButton.X = static_cast<Int16>(LOWORD(lParam));
event.MouseButton.Y = HIWORD(lParam); event.MouseButton.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }
@ -652,8 +652,8 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::MouseMoved; event.Type = Event::MouseMoved;
event.MouseMove.X = LOWORD(lParam); event.MouseMove.X = static_cast<Int16>(LOWORD(lParam));
event.MouseMove.Y = HIWORD(lParam); event.MouseMove.Y = static_cast<Int16>(HIWORD(lParam));
PushEvent(event); PushEvent(event);
break; break;
} }