Expose Main Window to c# through Screen class.

This commit is contained in:
Chandler Cox
2023-09-30 13:52:20 -05:00
parent fd3f10864b
commit 85a985cd7f
2 changed files with 15 additions and 0 deletions

View File

@@ -181,6 +181,15 @@ void Screen::SetGameWindowMode(GameWindowMode windowMode)
#endif
}
Window* Screen::GetMainWindow()
{
Window* win = nullptr;
#if !USE_EDITOR
win = Engine::MainWindow;
#endif
return win;
}
void ScreenService::Update()
{
#if USE_EDITOR

View File

@@ -96,4 +96,10 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screen);
/// </remarks>
/// <param name="windowMode">The window mode.</param>
API_PROPERTY() static void SetGameWindowMode(GameWindowMode windowMode);
/// <summary>
/// Gets the main window. Only during built game.
/// </summary>
/// <returns>The current window. Will be null if fails.</returns>
API_PROPERTY() static Window* GetMainWindow();
};