Added scripting quality of life features #299

Merged
Pycorax merged 10 commits from SP3-6-c-scripting into main 2023-01-01 12:37:10 +08:00
2 changed files with 16 additions and 1 deletions
Showing only changes of commit 8212ed2280 - Show all commits

View File

@ -44,6 +44,10 @@ namespace SHADE
return false;
}
bool Application::IsEditor::get()
{
return SHSystemManager::GetSystem<SHEditor>() != nullptr;
}
int Application::WindowWidth::get()
{
return SHGraphicsSystemInterface::GetWindowWidth();
@ -65,7 +69,10 @@ namespace SHADE
/* Usage Functions */
/*---------------------------------------------------------------------------------*/
void Application::Quit()
{
if (!IsEditor)
{
SHGraphicsSystemInterface::CloseWindow();
}
}
}

View File

@ -43,6 +43,13 @@ namespace SHADE
bool get();
}
/// <summary>
/// True if the engine is running in the editor.
/// </summary>
static property bool IsEditor
{
bool get();
}
/// <summary>
/// Retrieves the designated width of the current window.
/// </summary>
static property int WindowWidth
@ -71,6 +78,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Marks the application to stop at the end of the current frame.
/// If running in the editor, this function does nothing.
/// </summary>
static void Quit();
};