_window positioning that works on windows
This commit is contained in:
@@ -196,6 +196,10 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
}
|
||||
}
|
||||
|
||||
Int2 oldpos2(x, y);
|
||||
|
||||
// It should be noted that SDL creates the window in client-space coordinates (ignoring window decorations)
|
||||
|
||||
SDL_PropertiesID props = SDL_CreateProperties();
|
||||
SDL_SetNumberProperty(props, "flags", flags);
|
||||
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, settings.Title.ToStringAnsi().Get());
|
||||
@@ -242,16 +246,17 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings)
|
||||
SDL_GetWindowSizeInPixels(_window, &rect.w, &rect.h);
|
||||
_cachedClientRectangle = Rectangle((float)rect.x, (float)rect.y, (float)rect.w, (float)rect.h);
|
||||
|
||||
Int2 newpos = GetPosition();
|
||||
LOG(Info, "new window at {}, expected: {}", newpos, oldpos);
|
||||
ASSERT(newpos == oldpos);
|
||||
Int2 newpos = GetClientPosition();
|
||||
//Int2 newposclient = GetClientPosition();
|
||||
LOG(Info, "new window at {}, input {}, expected: {}", newpos, oldpos, oldpos2);
|
||||
ASSERT(newpos == oldpos || newpos == oldpos2);
|
||||
|
||||
oldpos = newpos;
|
||||
/*oldpos = newpos;
|
||||
SetPosition(newpos);
|
||||
newpos = GetPosition();
|
||||
|
||||
LOG(Info, "new window sanity set at {}", newpos);
|
||||
ASSERT(newpos == oldpos);
|
||||
ASSERT(newpos == oldpos);*/
|
||||
|
||||
SDL_SetWindowHitTest(_window, &OnWindowHitTest, this);
|
||||
InitSwapChain();
|
||||
@@ -952,6 +957,11 @@ void GetRelativeWindowPosition(const SDLWindow* window, Int2& relativePosition,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if PLATFORM_WINDOWS
|
||||
//relativePosition = Int2::Zero;
|
||||
return;
|
||||
#endif
|
||||
|
||||
SDLWindow* parent;
|
||||
if (SDLPlatform::UsesX11())
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace FlaxEngine.GUI
|
||||
WrapPosition(ref mousePos, 10);
|
||||
locationSS = mousePos + new Float2(15, 10);
|
||||
var ppp = Input.MouseScreenPosition;
|
||||
locationSS = new Float2(5, 5);
|
||||
//locationSS = new Float2(5, 5);
|
||||
var bef = locationSS;
|
||||
|
||||
// Create window
|
||||
@@ -231,7 +231,7 @@ namespace FlaxEngine.GUI
|
||||
var bef = _window.Position;
|
||||
WrapPosition(ref mousePos, 10);
|
||||
mousePos += new Float2(15, 10);
|
||||
mousePos = new Float2(5, 5);
|
||||
//mousePos = new Float2(5, 5);
|
||||
|
||||
if (_window)
|
||||
_window.Position = mousePos;
|
||||
|
||||
Reference in New Issue
Block a user