Merge pull request #223 from SHADE-DP/SP3-20-UI-System

Added UI and Canvas to editor
This commit is contained in:
XiaoQiDigipen 2022-11-18 16:39:46 +08:00 committed by GitHub
commit 9ada09dec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -18,6 +18,8 @@
#include "Physics/Interface/SHColliderComponent.h" #include "Physics/Interface/SHColliderComponent.h"
#include "Camera/SHCameraComponent.h" #include "Camera/SHCameraComponent.h"
#include "Camera/SHCameraArmComponent.h" #include "Camera/SHCameraArmComponent.h"
#include "UI/SHUIComponent.h"
#include "UI/SHCanvasComponent.h"
#include "SHEditorComponentView.h" #include "SHEditorComponentView.h"
namespace SHADE namespace SHADE
@ -132,6 +134,14 @@ namespace SHADE
{ {
DrawComponent(cameraArmComponent); DrawComponent(cameraArmComponent);
} }
if (auto canvasComponent= SHComponentManager::GetComponent_s<SHCanvasComponent>(eid))
{
DrawComponent(canvasComponent);
}
if (auto uiComponent = SHComponentManager::GetComponent_s<SHUIComponent>(eid))
{
DrawComponent(uiComponent);
}
ImGui::Separator(); ImGui::Separator();
// Render Scripts // Render Scripts
SHScriptEngine* scriptEngine = static_cast<SHScriptEngine*>(SHSystemManager::GetSystem<SHScriptEngine>()); SHScriptEngine* scriptEngine = static_cast<SHScriptEngine*>(SHSystemManager::GetSystem<SHScriptEngine>());
@ -143,6 +153,7 @@ namespace SHADE
DrawAddComponentButton<SHCameraComponent>(eid); DrawAddComponentButton<SHCameraComponent>(eid);
DrawAddComponentButton<SHCameraArmComponent>(eid); DrawAddComponentButton<SHCameraArmComponent>(eid);
DrawAddComponentButton<SHLightComponent>(eid); DrawAddComponentButton<SHLightComponent>(eid);
DrawAddComponentButton<SHCanvasComponent>(eid);
// Components that require Transforms // Components that require Transforms

View File

@ -17,6 +17,16 @@ namespace SHADE
return localToCanvasMatrix; return localToCanvasMatrix;
} }
EntityID SHUIComponent::GetCanvasID() const noexcept
{
return canvasID;
}
void SHUIComponent::SetCanvasID(EntityID id) noexcept
{
(void)id;
}
} }
@ -25,7 +35,8 @@ RTTR_REGISTRATION
using namespace SHADE; using namespace SHADE;
using namespace rttr; using namespace rttr;
registration::class_<SHUIComponent>("Canvas Component") registration::class_<SHUIComponent>("UI Component")
.property("Canvas ID", &SHUIComponent::GetCanvasID, &SHUIComponent::SetCanvasID)
; ;

View File

@ -18,7 +18,8 @@ namespace SHADE
~SHUIComponent() = default; ~SHUIComponent() = default;
SHMatrix const& GetMatrix() const noexcept; SHMatrix const& GetMatrix() const noexcept;
EntityID GetCanvasID() const noexcept;
void SetCanvasID(EntityID id) noexcept;
private: private:
SHMatrix localToCanvasMatrix; SHMatrix localToCanvasMatrix;