Add Engine.FocusGameViewport to implement game menu with camera focus gather
This commit is contained in:
@@ -409,6 +409,19 @@ JsonAsset* Engine::GetCustomSettings(const StringView& key)
|
||||
return Content::LoadAsync<JsonAsset>(assetId);
|
||||
}
|
||||
|
||||
void Engine::FocusGameViewport()
|
||||
{
|
||||
#if USE_EDITOR
|
||||
Editor::Managed->FocusGameViewport();
|
||||
#else
|
||||
if (MainWindow)
|
||||
{
|
||||
MainWindow->BringToFront();
|
||||
MainWindow->Focus();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Engine::HasGameViewportFocus()
|
||||
{
|
||||
#if USE_EDITOR
|
||||
|
||||
@@ -153,6 +153,11 @@ public:
|
||||
|
||||
static Window* MainWindow;
|
||||
|
||||
/// <summary>
|
||||
/// Brings focused to the game viewport (game can receive input).
|
||||
/// </summary>
|
||||
API_FUNCTION() static void FocusGameViewport();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whenever the game viewport is focused by the user (eg. can receive input).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user