Added Buttons, Added Canvas Scaling matrix, Added Serialization of buttons and camera arm #250

Merged
maverickdgg merged 7 commits from SP3-20-UI-System into main 2022-11-22 20:57:49 +08:00
4 changed files with 61 additions and 1 deletions
Showing only changes of commit 5d04149797 - Show all commits

View File

@ -0,0 +1,15 @@
#include "SHpch.h"
#include "SHButtonComponent.h"
namespace SHADE
{
SHButtonComponent::SHButtonComponent()
:size(0.0f), offset(0.0f), isHovered(false)
{
}
}

View File

@ -0,0 +1,31 @@
#pragma once
#include "SH_API.h"
#include "ECS_Base/Components/SHComponent.h"
#include "Math/Vector/SHVec3.h"
#include "Math/Vector/SHVec2.h"
namespace SHADE
{
class SH_API SHButtonComponent final: public SHComponent
{
public:
SHButtonComponent();
~SHButtonComponent() = default;
SHVec2 size;
SHVec2 offset;
private:
bool isHovered;
};
}

View File

@ -108,6 +108,10 @@ namespace SHADE
}
}
void SHUISystem::UpdateButtonComponent(SHButtonComponent& comp) noexcept
{
}
}//end namespace

View File

@ -4,6 +4,7 @@
#include "ECS_Base/System/SHSystem.h"
#include "ECS_Base/System/SHSystemRoutine.h"
#include "SHUIComponent.h"
#include "SHButtonComponent.h"
#include "SHCanvasComponent.h"
#include "Scene/SHSceneGraph.h"
#include "Scene/SHSceneManager.h"
@ -39,13 +40,22 @@ namespace SHADE
friend class UpdateUIMatrixRoutine;
class SH_API UpdateButtonsRoutine final: public SHSystemRoutine
{
public:
UpdateButtonsRoutine() : SHSystemRoutine("Update Buttons Routine", true) {};
virtual void Execute(double dt) noexcept override final;
};
friend class UpdateButtonsRoutine;
void Init();
void Exit();
private:
void UpdateUIComponent(SHUIComponent& comp) noexcept;
void UpdateButtonComponent(SHButtonComponent& comp) noexcept;