From c9db8262b76388a9562f48a55bde5be97d4d4fd2 Mon Sep 17 00:00:00 2001 From: Xiao Qi Date: Fri, 3 Feb 2023 19:37:56 +0800 Subject: [PATCH] Added preprocessor checks for editor --- SHADE_Application/src/Application/SBApplication.cpp | 10 ++++++---- SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h | 2 +- SHADE_Engine/src/Physics/System/SHPhysicsSystem.h | 5 +---- SHADE_Engine/src/Scripting/SHScriptEngine.cpp | 4 ++-- SHADE_Managed/src/Engine/Application.cxx | 9 ++++++++- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index e97d9eb4..ffc4bacc 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -5,6 +5,7 @@ //#define SHEDITOR #ifdef SHEDITOR #include "Editor/SHEditor.h" +#include "Physics/System/SHPhysicsDebugDrawSystem.h" //#include "Scenes/SBEditorScene.h" #endif // SHEDITOR @@ -31,7 +32,6 @@ #include "Input/SHInputManager.h" #include "Math/Transform/SHTransformSystem.h" #include "Physics/System/SHPhysicsSystem.h" -#include "Physics/System/SHPhysicsDebugDrawSystem.h" #include "Scripting/SHScriptEngine.h" #include "UI/SHUISystem.h" #include "Animation/SHAnimationSystem.h" @@ -74,12 +74,15 @@ namespace Sandbox #endif window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow, wndData); + + SHAssetManager::Load(); + // Create Systems SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); -#ifndef _PUBLISH +#ifdef SHEDITOR SHSystemManager::CreateSystem(); #endif @@ -122,7 +125,7 @@ namespace Sandbox SHSystemManager::RegisterRoutine(); SHSystemManager::RegisterRoutine(); -#ifndef _PUBLISH +#ifdef SHEDITOR SHSystemManager::RegisterRoutine(); #endif @@ -155,7 +158,6 @@ namespace Sandbox SHComponentManager::CreateComponentSparseSet(); //SHComponentManager::CreateComponentSparseSet(); - SHAssetManager::Load(); //auto font = SHAssetManager::GetData(176667660); SHSystemManager::RegisterRoutine(); diff --git a/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h b/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h index 995a1cf5..d02ba3d5 100644 --- a/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h +++ b/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h @@ -94,7 +94,7 @@ namespace SHADE if (systemContainer.find(id) == systemContainer.end()) { - std::cout << "System Manager error: System Version " << version << " does not exit." << std::endl; + std::cout << "System Manager error: System Version " << typeid(T).name() << ", " << version << " does not exist." << std::endl; return nullptr; } diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h index 312c3625..c80e5d5c 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h +++ b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h @@ -169,11 +169,8 @@ namespace SHADE SHPhysicsObjectManager objectManager; SHCollisionListener collisionListener; SHRaycaster raycaster; - - // For the debug drawer to draw rays - #ifdef SHEDITOR + std::vector raycastHits; - #endif /*---------------------------------------------------------------------------------*/ /* Function Members */ diff --git a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp index 435cb6fb..e6d97f74 100644 --- a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp +++ b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp @@ -62,9 +62,9 @@ namespace SHADE loadFunctions(); // Generate script assembly if it hasn't been before -#ifndef _PUBLISH + #ifndef _PUBLISH BuildScriptAssembly(); -#endif + #endif // Initialise the CSharp Engine csEngineInit(); diff --git a/SHADE_Managed/src/Engine/Application.cxx b/SHADE_Managed/src/Engine/Application.cxx index 06ad632f..5bde66d2 100644 --- a/SHADE_Managed/src/Engine/Application.cxx +++ b/SHADE_Managed/src/Engine/Application.cxx @@ -28,25 +28,32 @@ namespace SHADE /*---------------------------------------------------------------------------------*/ bool Application::IsPlaying::get() { +#ifdef SHEDITOR auto editor = SHSystemManager::GetSystem(); if (editor) return editor->editorState == SHEditor::State::PLAY || editor->editorState == SHEditor::State::PAUSE; +#endif return true; } bool Application::IsPaused::get() { +#ifdef SHEDITOR auto editor = SHSystemManager::GetSystem(); if (editor) return editor->editorState == SHEditor::State::PAUSE; - +#endif return false; } bool Application::IsEditor::get() { +#ifdef SHEDITOR return SHSystemManager::GetSystem() != nullptr; +#else + return false; +#endif } int Application::WindowWidth::get() {