Added function to get viewport size of the game window when in editor. This allows for certain functions to behave correctly.
This commit is contained in:
@@ -1408,6 +1408,23 @@ namespace FlaxEditor
|
||||
}
|
||||
}
|
||||
|
||||
internal void Internal_GetGameWindowViewportSize(out Float2 result)
|
||||
{
|
||||
result = new Float2(1280, 720);
|
||||
var gameWin = Windows.GameWin;
|
||||
if (gameWin?.Root?.RootWindow is WindowRootControl root)
|
||||
{
|
||||
// Handle case when Game window is not selected in tab view
|
||||
var dockedTo = gameWin.ParentDockPanel;
|
||||
if (dockedTo != null && dockedTo.SelectedTab != gameWin && dockedTo.SelectedTab != null)
|
||||
result = dockedTo.SelectedTab.Size * root.DpiScale;
|
||||
else
|
||||
result = gameWin.Viewport.Size * root.DpiScale;
|
||||
|
||||
result = Float2.Round(result);
|
||||
}
|
||||
}
|
||||
|
||||
internal bool Internal_OnAppExit()
|
||||
{
|
||||
// In editor play mode (when main window is not closed) just skip engine exit and leave the play mode
|
||||
|
||||
Reference in New Issue
Block a user