diff --git a/SHADE_Engine/src/Camera/SHCameraSystem.cpp b/SHADE_Engine/src/Camera/SHCameraSystem.cpp index a574b47f..95a461f8 100644 --- a/SHADE_Engine/src/Camera/SHCameraSystem.cpp +++ b/SHADE_Engine/src/Camera/SHCameraSystem.cpp @@ -590,9 +590,9 @@ namespace SHADE #endif } - SHCameraComponent* SHCameraSystem::GetMainCamera() const noexcept + EntityID SHCameraSystem::GetMainCameraEID() const noexcept { - return SHComponentManager::GetComponent_s(directorHandleList[0]->mainCameraEID); + return directorHandleList[0]->mainCameraEID; } } diff --git a/SHADE_Engine/src/Camera/SHCameraSystem.h b/SHADE_Engine/src/Camera/SHCameraSystem.h index 65761eb1..e7d06ddc 100644 --- a/SHADE_Engine/src/Camera/SHCameraSystem.h +++ b/SHADE_Engine/src/Camera/SHCameraSystem.h @@ -65,7 +65,7 @@ namespace SHADE void SetCameraViewMatrix(SHCameraComponent& camera, SHMatrix const& viewMatrix, bool takePos) noexcept; void CameraLookAt(SHCameraComponent& camera, SHVec3 target) noexcept; void UpdateEditorArm(double dt,bool active ,SHVec3 const& targetPos) noexcept; - SHCameraComponent* GetMainCamera() const noexcept; + EntityID GetMainCameraEID() const noexcept; SHVec2 GetCameraWidthHeight(size_t index) noexcept; }; diff --git a/SHADE_Managed/src/Components/Camera.cxx b/SHADE_Managed/src/Components/Camera.cxx index 4640c17a..22eb2124 100644 --- a/SHADE_Managed/src/Components/Camera.cxx +++ b/SHADE_Managed/src/Components/Camera.cxx @@ -13,7 +13,6 @@ namespace SHADE } - float Camera::Pitch::get() { return (GetNativeComponent()->GetPitch()); @@ -126,4 +125,10 @@ namespace SHADE } + Camera^ Camera::GetMainCamera() + { + auto system = SHSystemManager::GetSystem(); + return ECS::GetComponent(system->GetMainCameraEID()); + } + } \ No newline at end of file diff --git a/SHADE_Managed/src/Components/Camera.hxx b/SHADE_Managed/src/Components/Camera.hxx index c793f1ed..babf2c28 100644 --- a/SHADE_Managed/src/Components/Camera.hxx +++ b/SHADE_Managed/src/Components/Camera.hxx @@ -15,6 +15,9 @@ namespace SHADE Camera(Entity entity); public: + + + property float Pitch { float get(); @@ -65,5 +68,8 @@ namespace SHADE Vector3 GetForward(); Vector3 GetRight(); + + static Camera^ GetMainCamera(); + }; } \ No newline at end of file