Canvas and UI Component #222
|
@ -37,8 +37,6 @@ namespace SHADE
|
|||
void Exit (void);
|
||||
|
||||
|
||||
friend class EditorCameraUpdate;
|
||||
|
||||
class SH_API CameraSystemUpdate final: public SHSystemRoutine
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#include "SHpch.h"
|
||||
|
||||
#include "SHCanvasComponent.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
||||
SHCanvasComponent::SHCanvasComponent()
|
||||
:width(1),height(1), dirtyMatrix(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SHCanvasComponent::SetCanvasSize(CanvasSizeType width, CanvasSizeType height) noexcept
|
||||
{
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
void SHCanvasComponent::SetCanvasWidth(CanvasSizeType val) noexcept
|
||||
{
|
||||
width = val;
|
||||
}
|
||||
|
||||
void SHCanvasComponent::SetCanvasHeight(CanvasSizeType val) noexcept
|
||||
{
|
||||
height = val;
|
||||
}
|
||||
|
||||
|
||||
SHCanvasComponent::CanvasSizeType const SHCanvasComponent::GetCanvasWidth() const noexcept
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
SHCanvasComponent::CanvasSizeType const SHCanvasComponent::GetCanvasHeight() const noexcept
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
RTTR_REGISTRATION
|
||||
{
|
||||
using namespace SHADE;
|
||||
using namespace rttr;
|
||||
|
||||
registration::class_<SHCanvasComponent>("Canvas Component")
|
||||
.property("Canvas Width", &SHCanvasComponent::GetCanvasWidth, &SHCanvasComponent::SetCanvasWidth)
|
||||
.property("Canvas Height", &SHCanvasComponent::GetCanvasHeight, &SHCanvasComponent::SetCanvasHeight)
|
||||
;
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <rttr/registration>
|
||||
|
||||
#include "SH_API.h"
|
||||
#include "ECS_Base/Components/SHComponent.h"
|
||||
#include "Math/SHMatrix.h"
|
||||
|
||||
|
||||
namespace SHADE
|
||||
|
@ -13,6 +16,9 @@ namespace SHADE
|
|||
|
||||
|
||||
public:
|
||||
friend class SHUISystem;
|
||||
|
||||
|
||||
SHCanvasComponent();
|
||||
~SHCanvasComponent() = default;
|
||||
|
||||
|
@ -26,9 +32,11 @@ namespace SHADE
|
|||
private:
|
||||
CanvasSizeType width;
|
||||
CanvasSizeType height;
|
||||
|
||||
|
||||
bool dirtyMatrix;
|
||||
SHMatrix modelToCanvasMatrix;
|
||||
|
||||
|
||||
RTTR_ENABLE()
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#include "SHpch.h"
|
||||
#include "SHUIComponent.h"
|
||||
|
||||
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
||||
SHUIComponent::SHUIComponent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
SHMatrix const& SHUIComponent::GetMatrix()const noexcept
|
||||
{
|
||||
return LocalToCanvasMatrix;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <rttr/registration>
|
||||
|
||||
#include "SH_API.h"
|
||||
#include "ECS_Base/Components/SHComponent.h"
|
||||
#include "Math/SHMatrix.h"
|
||||
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
class SH_API SHUIComponent final: public SHComponent
|
||||
{
|
||||
public:
|
||||
friend class SHUISystem;
|
||||
|
||||
SHUIComponent();
|
||||
~SHUIComponent() = default;
|
||||
|
||||
SHMatrix const& GetMatrix() const noexcept;
|
||||
|
||||
|
||||
private:
|
||||
SHMatrix LocalToCanvasMatrix;
|
||||
|
||||
|
||||
|
||||
RTTR_ENABLE()
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue