Merge branch 'master' into 1.1
# Conflicts: # Source/Engine/Content/JsonAsset.h # Source/Engine/Core/Config/Settings.h
This commit is contained in:
@@ -632,8 +632,19 @@ void WindowsPlatform::Exit()
|
||||
|
||||
void WindowsPlatform::Log(const StringView& msg)
|
||||
{
|
||||
OutputDebugStringW(msg.Get());
|
||||
OutputDebugStringW(TEXT(PLATFORM_LINE_TERMINATOR));
|
||||
Char buffer[512];
|
||||
Char* str;
|
||||
if (msg.Length() + 3 < ARRAY_COUNT(buffer))
|
||||
str = buffer;
|
||||
else
|
||||
str = (Char*)Allocate((msg.Length() + 3) * sizeof(Char), 16);
|
||||
MemoryCopy(str, msg.Get(), msg.Length() * sizeof(Char));
|
||||
str[msg.Length() + 0] = '\r';
|
||||
str[msg.Length() + 1] = '\n';
|
||||
str[msg.Length() + 2] = 0;
|
||||
OutputDebugStringW(str);
|
||||
if (str != buffer)
|
||||
Free(str);
|
||||
}
|
||||
|
||||
bool WindowsPlatform::IsDebuggerPresent()
|
||||
|
||||
@@ -479,6 +479,10 @@ void WindowsWindow::StartTrackingMouse(bool useMouseScreenOffset)
|
||||
_trackingMouseOffset = Vector2::Zero;
|
||||
_isUsingMouseOffset = useMouseScreenOffset;
|
||||
|
||||
int32 x = 0 , y = 0, width = 0, height = 0;
|
||||
GetScreenInfo(x, y, width, height);
|
||||
_mouseOffsetScreenSize = Rectangle(x, y, width, height);
|
||||
|
||||
SetCapture(_handle);
|
||||
}
|
||||
}
|
||||
@@ -712,18 +716,20 @@ LRESULT WindowsWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
if (_isTrackingMouse && _isUsingMouseOffset)
|
||||
{
|
||||
// Check if move mouse to another edge of the desktop
|
||||
Vector2 destopSize = Platform::GetVirtualDesktopSize();
|
||||
Vector2 desktopLocation = _mouseOffsetScreenSize.Location;
|
||||
Vector2 destopSize = _mouseOffsetScreenSize.GetBottomRight();
|
||||
|
||||
const Vector2 mousePos(static_cast<float>(WINDOWS_GET_X_LPARAM(lParam)), static_cast<float>(WINDOWS_GET_Y_LPARAM(lParam)));
|
||||
Vector2 mousePosition = ClientToScreen(mousePos);
|
||||
Vector2 newMousePosition = mousePosition;
|
||||
if (mousePosition.X <= 1)
|
||||
if (mousePosition.X <= desktopLocation.X + 2)
|
||||
newMousePosition.X = destopSize.X - 2;
|
||||
else if (mousePosition.X >= destopSize.X - 1)
|
||||
newMousePosition.X = 2;
|
||||
if (mousePosition.Y <= 1)
|
||||
newMousePosition.X = desktopLocation.X + 2;
|
||||
if (mousePosition.Y <= desktopLocation.Y + 2)
|
||||
newMousePosition.Y = destopSize.Y - 2;
|
||||
else if (mousePosition.Y >= destopSize.Y - 1)
|
||||
newMousePosition.Y = 2;
|
||||
newMousePosition.Y = desktopLocation.Y + 2;
|
||||
if (!Vector2::NearEqual(mousePosition, newMousePosition))
|
||||
{
|
||||
_trackingMouseOffset -= newMousePosition - mousePosition;
|
||||
|
||||
Reference in New Issue
Block a user