Added 3 button event. Changed hovered and clicked boolean to be stored in UIComponent instead. Fixed Canvas Scaling matrix. #356

Merged
maverickdgg merged 3 commits from SP3-20-UI-System into main 2023-02-21 15:49:28 +08:00
13 changed files with 148 additions and 129 deletions

View File

@ -1,4 +1,4 @@
Start Maximized: true Start Maximized: true
Working Scene ID: 86098106 Working Scene ID: 97158628
Window Size: {x: 1920, y: 1013} Window Size: {x: 1920, y: 1013}
Style: 0 Style: 0

View File

@ -6,6 +6,7 @@
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
Canvas Height: 1080 Canvas Height: 1080
Scale by canvas width: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 1 - EID: 1
@ -24,6 +25,8 @@
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 0 Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 5 - EID: 5
@ -47,6 +50,8 @@
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 0 Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: Scripts:
- Type: ChangeSceneButton - Type: ChangeSceneButton
@ -73,6 +78,8 @@
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 0 Canvas ID: 0
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: Scripts:
- Type: QuitButton - Type: QuitButton
@ -106,11 +113,12 @@
Pitch: 0 Pitch: 0
Yaw: 0 Yaw: 0
Roll: 0 Roll: 0
Width: 1920 Width: 1319
Height: 1080 Height: 622
Near: 0.00999999978 Near: 0.00999999978
Far: 10000 Far: 10000
Perspective: true Perspective: true
FOV: 90
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 4 - EID: 4

View File

@ -26,4 +26,7 @@ constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_ENABLE_SHADOW_EVENT { 17 };
constexpr SHEventIdentifier SH_BUTTON_CLICK_EVENT { 18 }; constexpr SHEventIdentifier SH_BUTTON_CLICK_EVENT { 18 };
constexpr SHEventIdentifier SH_PHYSICS_COLLIDER_DRAW_EVENT { 19 }; constexpr SHEventIdentifier SH_PHYSICS_COLLIDER_DRAW_EVENT { 19 };
constexpr SHEventIdentifier SH_WINDOW_RESIZE_EVENT { 20 }; constexpr SHEventIdentifier SH_WINDOW_RESIZE_EVENT { 20 };
constexpr SHEventIdentifier SH_BUTTON_RELEASE_EVENT { 21 };
constexpr SHEventIdentifier SH_BUTTON_HOVER_ENTER_EVENT { 22 };
constexpr SHEventIdentifier SH_BUTTON_HOVER_EXIT_EVENT { 23 };

View File

@ -6,8 +6,7 @@
namespace SHADE namespace SHADE
{ {
SHButtonComponent::SHButtonComponent() SHButtonComponent::SHButtonComponent()
:size(1.0f), isHovered(false), isClicked(false), : defaultTexture(0), hoveredTexture(0), clickedTexture(0), currentTexture(0)
defaultTexture(0), hoveredTexture(0), clickedTexture(0), currentTexture(0)
{ {
} }
@ -41,6 +40,9 @@ namespace SHADE
clickedTexture = texture; clickedTexture = texture;
} }
} }

View File

@ -17,8 +17,6 @@ namespace SHADE
SHButtonComponent(); SHButtonComponent();
virtual ~SHButtonComponent() = default; virtual ~SHButtonComponent() = default;
SHVec2 size;
AssetID GetClickedTexture() const noexcept; AssetID GetClickedTexture() const noexcept;
AssetID GetDefaultTexture() const noexcept; AssetID GetDefaultTexture() const noexcept;
AssetID GetHoveredTexture() const noexcept; AssetID GetHoveredTexture() const noexcept;
@ -32,11 +30,7 @@ namespace SHADE
friend class SHUISystem; friend class SHUISystem;
private: private:
//Set to true when mouse is hovering over the button.
bool isHovered;
//This is set to true when the mouse clicks down, and set back to false when mouse releases.
//The event for the button click will be broadcasted when mouse release.
bool isClicked;
AssetID defaultTexture; AssetID defaultTexture;
AssetID hoveredTexture; AssetID hoveredTexture;
AssetID clickedTexture; AssetID clickedTexture;

View File

@ -6,7 +6,7 @@ namespace SHADE
{ {
SHCanvasComponent::SHCanvasComponent() SHCanvasComponent::SHCanvasComponent()
:width(1),height(1), dirtyMatrix(false), canvasMatrix() :width(1), height(1), dirtyMatrix(false), canvasMatrix(), scaleByCanvasWidth(false)
{ {
} }
@ -28,6 +28,8 @@ namespace SHADE
} }
SHCanvasComponent::CanvasSizeType SHCanvasComponent::GetCanvasWidth() const noexcept SHCanvasComponent::CanvasSizeType SHCanvasComponent::GetCanvasWidth() const noexcept
{ {
return width; return width;
@ -43,6 +45,8 @@ namespace SHADE
return canvasMatrix; return canvasMatrix;
} }
} }
@ -54,6 +58,7 @@ RTTR_REGISTRATION
registration::class_<SHCanvasComponent>("Canvas Component") registration::class_<SHCanvasComponent>("Canvas Component")
.property("Canvas Width", &SHCanvasComponent::GetCanvasWidth, &SHCanvasComponent::SetCanvasWidth) .property("Canvas Width", &SHCanvasComponent::GetCanvasWidth, &SHCanvasComponent::SetCanvasWidth)
.property("Canvas Height", &SHCanvasComponent::GetCanvasHeight, &SHCanvasComponent::SetCanvasHeight) .property("Canvas Height", &SHCanvasComponent::GetCanvasHeight, &SHCanvasComponent::SetCanvasHeight)
.property("Scale by canvas width", &SHCanvasComponent::scaleByCanvasWidth)
; ;

View File

@ -21,15 +21,18 @@ namespace SHADE
SHCanvasComponent(); SHCanvasComponent();
~SHCanvasComponent() = default; ~SHCanvasComponent() = default;
bool scaleByCanvasWidth;
void SetCanvasSize(CanvasSizeType width, CanvasSizeType height) noexcept; void SetCanvasSize(CanvasSizeType width, CanvasSizeType height) noexcept;
void SetCanvasWidth(CanvasSizeType width) noexcept; void SetCanvasWidth(CanvasSizeType width) noexcept;
void SetCanvasHeight(CanvasSizeType height) noexcept; void SetCanvasHeight(CanvasSizeType height) noexcept;
CanvasSizeType GetCanvasWidth() const noexcept; CanvasSizeType GetCanvasWidth() const noexcept;
CanvasSizeType GetCanvasHeight() const noexcept; CanvasSizeType GetCanvasHeight() const noexcept;
SHMatrix const& GetMatrix() const noexcept; SHMatrix const& GetMatrix() const noexcept;
private: private:
CanvasSizeType width; CanvasSizeType width;
CanvasSizeType height; CanvasSizeType height;

View File

@ -5,8 +5,7 @@
namespace SHADE namespace SHADE
{ {
SHToggleButtonComponent::SHToggleButtonComponent() SHToggleButtonComponent::SHToggleButtonComponent()
:size(1.0f), isHovered(false), isClicked(false), value(false), :value(false), defaultTexture(0), toggledTexture(0), currentTexture(0)
defaultTexture(0), toggledTexture(0), currentTexture(0)
{ {
} }

View File

@ -17,8 +17,6 @@ namespace SHADE
SHToggleButtonComponent(); SHToggleButtonComponent();
virtual ~SHToggleButtonComponent() = default; virtual ~SHToggleButtonComponent() = default;
SHVec2 size;
AssetID GetToggledTexture() const noexcept; AssetID GetToggledTexture() const noexcept;
AssetID GetDefaultTexture() const noexcept; AssetID GetDefaultTexture() const noexcept;
bool GetValue() const noexcept; bool GetValue() const noexcept;
@ -33,11 +31,7 @@ namespace SHADE
friend class SHUISystem; friend class SHUISystem;
private: private:
//Set to true when mouse is hovering over the button.
bool isHovered;
//This is set to true when the mouse clicks down, and set back to false when mouse releases.
//The event for the button click will be broadcasted when mouse release.
bool isClicked;
bool value; bool value;
AssetID defaultTexture; AssetID defaultTexture;
AssetID toggledTexture; AssetID toggledTexture;

View File

@ -7,6 +7,7 @@ namespace SHADE
{ {
SHUIComponent::SHUIComponent() SHUIComponent::SHUIComponent()
:size(1.0f), isHovered(false), isClicked(false)
{ {
} }
@ -27,6 +28,20 @@ namespace SHADE
(void)id; (void)id;
} }
bool SHUIComponent::GetIsHovered() const noexcept
{
return isHovered;
}
bool SHUIComponent::GetIsClicked() const noexcept
{
return isClicked;
}
void SHUIComponent::SetEmptyHoveredClick(bool value) noexcept
{
(void)value;
}
} }
@ -37,6 +52,8 @@ RTTR_REGISTRATION
registration::class_<SHUIComponent>("UI Component") registration::class_<SHUIComponent>("UI Component")
.property("Canvas ID", &SHUIComponent::GetCanvasID, &SHUIComponent::SetCanvasID) .property("Canvas ID", &SHUIComponent::GetCanvasID, &SHUIComponent::SetCanvasID)
.property("Hovered", &SHUIComponent::GetIsHovered, &SHUIComponent::SetEmptyHoveredClick)
.property("Clicked", &SHUIComponent::GetIsClicked, &SHUIComponent::SetEmptyHoveredClick)
; ;

View File

@ -5,6 +5,7 @@
#include "SH_API.h" #include "SH_API.h"
#include "ECS_Base/Components/SHComponent.h" #include "ECS_Base/Components/SHComponent.h"
#include "Math/SHMatrix.h" #include "Math/SHMatrix.h"
#include "Math/Vector/SHVec2.h"
namespace SHADE namespace SHADE
@ -17,14 +18,29 @@ namespace SHADE
SHUIComponent(); SHUIComponent();
~SHUIComponent() = default; ~SHUIComponent() = default;
SHVec2 size;
SHMatrix const& GetMatrix() const noexcept; SHMatrix const& GetMatrix() const noexcept;
EntityID GetCanvasID() const noexcept; EntityID GetCanvasID() const noexcept;
void SetCanvasID(EntityID id) noexcept; void SetCanvasID(EntityID id) noexcept;
bool GetIsHovered() const noexcept;
bool GetIsClicked() const noexcept;
void SetEmptyHoveredClick(bool value)noexcept;
private: private:
SHMatrix localToCanvasMatrix; SHMatrix localToCanvasMatrix;
EntityID canvasID; EntityID canvasID;
//Set to true when mouse is hovering over the button. Only set if there is a Button/Slider/ToggleButton comp.
bool isHovered;
//This is set to true when the mouse clicks down, and set back to false when mouse releases. Only set if there is a Button/Slider/ToggleButton comp.
bool isClicked;
RTTR_ENABLE() RTTR_ENABLE()
}; };

View File

@ -131,8 +131,17 @@ namespace SHADE
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>(); auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
SHVec2 camSize = cameraSystem->GetCameraWidthHeight(0); SHVec2 camSize = cameraSystem->GetCameraWidthHeight(0);
comp.canvasMatrix = SHMatrix::Identity; comp.canvasMatrix = SHMatrix::Identity;
comp.canvasMatrix(0, 0) = camSize.x * 0.5f / (comp.GetCanvasWidth() * 0.5f); float scale = camSize.y / comp.GetCanvasHeight();
comp.canvasMatrix(1, 1) = camSize.y * 0.5f / (comp.GetCanvasHeight() * 0.5f); if (comp.scaleByCanvasWidth)
{
scale = camSize.x / comp.GetCanvasWidth();
}
comp.canvasMatrix(0, 0) = scale;
comp.canvasMatrix(1, 1) = scale;
//comp.canvasMatrix(0, 0) = camSize.x * 0.5f / (comp.GetCanvasWidth() * 0.5f);
//comp.canvasMatrix(1, 1) = camSize.y * 0.5f / (comp.GetCanvasHeight() * 0.5f);
} }
void SHUISystem::UpdateCanvasMatrixRoutine::Execute(double dt) noexcept void SHUISystem::UpdateCanvasMatrixRoutine::Execute(double dt) noexcept
@ -146,25 +155,15 @@ namespace SHADE
} }
} }
bool SHUISystem::CheckButtonHoveredOrClicked(SHUIComponent& comp) noexcept
void SHUISystem::UpdateButtonComponent(SHButtonComponent& comp) noexcept
{ {
if (!SHComponentManager::HasComponent<SHUIComponent>(comp.GetEID())) SHVec4 topExtent4 = SHMatrix::Translate(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f) * comp.GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
{ SHVec4 btmExtent4 = SHMatrix::Translate(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f) * comp.GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
return;
}
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
SHVec4 topExtent4 = SHMatrix::Translate(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
SHVec4 btmExtent4 = SHMatrix::Translate(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f,0.0f, 0.0f,1.0f);
SHVec2 topExtent{ topExtent4.x,topExtent4.y }; SHVec2 topExtent{ topExtent4.x,topExtent4.y };
SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y }; SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y };
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
SHVec2 mousePos; SHVec2 mousePos;
SHVec2 windowSize; SHVec2 windowSize;
#ifdef SHEDITOR #ifdef SHEDITOR
@ -188,11 +187,11 @@ namespace SHADE
mousePos /= windowSize; mousePos /= windowSize;
#endif #endif
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0)}; SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0) };
//SHLOG_INFO("TopExtent: {}, {}", topExtent.x, topExtent.y) //SHLOG_INFO("TopExtent: {}, {}", topExtent.x, topExtent.y)
topExtent = CanvasToScreenPoint(topExtent,true); topExtent = CanvasToScreenPoint(topExtent, true);
btmExtent = CanvasToScreenPoint(btmExtent,true); btmExtent = CanvasToScreenPoint(btmExtent, true);
//SHLOG_INFO("TopExtent: {}, {} Btm Extent: {}, {}", topExtent.x, topExtent.y, btmExtent.x, btmExtent.y) //SHLOG_INFO("TopExtent: {}, {} Btm Extent: {}, {}", topExtent.x, topExtent.y, btmExtent.x, btmExtent.y)
@ -200,26 +199,48 @@ namespace SHADE
if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x
&& mousePos.y >= topExtent.y && mousePos.y <= btmExtent.y) && mousePos.y >= topExtent.y && mousePos.y <= btmExtent.y)
{ {
if (comp.isHovered == false)
{
SHButtonClickEvent clickEvent;
clickEvent.EID = comp.GetEID();
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_HOVER_ENTER_EVENT);
}
comp.isHovered = true; comp.isHovered = true;
#ifdef SHEDITOR
#ifdef SHEDITOR
//if (SHSystemManager::GetSystem<SHEditor>()->editorState == SHEditor::State::PLAY) //if (SHSystemManager::GetSystem<SHEditor>()->editorState == SHEditor::State::PLAY)
{ {
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB)) if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
{ {
comp.isClicked = true; comp.isClicked = true;
SHButtonClickEvent clickEvent;
clickEvent.EID = comp.GetEID();
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT);
} }
} }
#else #else
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB)) if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
{ {
comp.isClicked = true; comp.isClicked = true;
SHButtonClickEvent clickEvent;
clickEvent.EID = comp.GetEID();
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT);
} }
#endif #endif
//SHLOG_INFO("HOVERED") //SHLOG_INFO("HOVERED")
} }
else else
{ {
if (comp.isHovered == true)
{
SHButtonClickEvent clickEvent;
clickEvent.EID = comp.GetEID();
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_HOVER_EXIT_EVENT);
}
comp.isHovered = false; comp.isHovered = false;
//SHLOG_INFO("NOT HOVERED") //SHLOG_INFO("NOT HOVERED")
} }
@ -228,9 +249,31 @@ namespace SHADE
comp.isClicked = false; comp.isClicked = false;
SHButtonClickEvent clickEvent; SHButtonClickEvent clickEvent;
clickEvent.EID = comp.GetEID(); clickEvent.EID = comp.GetEID();
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT); SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_RELEASE_EVENT);
return true;
} }
return false;
}
void SHUISystem::UpdateButtonComponent(SHButtonComponent& comp) noexcept
{
if (!SHComponentManager::HasComponent<SHUIComponent>(comp.GetEID()))
{
return;
}
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
CheckButtonHoveredOrClicked(*uiComp);
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID())) if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
{ {
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID()); auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
@ -238,7 +281,7 @@ namespace SHADE
AssetID textureID = 0; AssetID textureID = 0;
if (!comp.isHovered && !comp.isClicked) if (!uiComp->isHovered && !uiComp->isClicked)
{ {
if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE) if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
{ {
@ -247,7 +290,7 @@ namespace SHADE
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")
} }
} }
else if (comp.isClicked) else if (uiComp->isClicked)
{ {
if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE) if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
{ {
@ -288,80 +331,10 @@ namespace SHADE
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID()); auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
//auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID); //auto canvasComp = SHComponentManager::GetComponent_s<SHCanvasComponent>(uiComp->canvasID);
SHVec4 topExtent4 = SHMatrix::Translate(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
SHVec4 btmExtent4 = SHMatrix::Translate(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
SHVec2 topExtent{ topExtent4.x,topExtent4.y }; if (CheckButtonHoveredOrClicked(*uiComp))
SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y };
SHVec2 mousePos;
SHVec2 windowSize;
#ifdef SHEDITOR
windowSize = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->beginContentRegionAvailable;
mousePos = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->viewportMousePos;
//mousePos.y = windowSize.y - mousePos.y;
//SHLOG_INFO("mouse pos: {}, {}", mousePos.x, mousePos.y)
mousePos /= windowSize;
//SHLOG_INFO("mouse pos normalized: {}, {}", mousePos.x, mousePos.y)
#else
int x, y;
SHInputManager::GetMouseScreenPosition(&x, &y);
mousePos.x = x;
mousePos.y = y;
auto ws = SHSystemManager::GetSystem<SHGraphicsSystem>()->GetWindow()->GetWindowSize();
windowSize = { static_cast<float>(ws.first), static_cast<float>(ws.second) };
mousePos /= windowSize;
#endif
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0) };
//SHLOG_INFO("TopExtent: {}, {}", topExtent.x, topExtent.y)
topExtent = CanvasToScreenPoint(topExtent, true);
btmExtent = CanvasToScreenPoint(btmExtent, true);
//SHLOG_INFO("TopExtent: {}, {} Btm Extent: {}, {}", topExtent.x, topExtent.y, btmExtent.x, btmExtent.y)
//comp.isClicked = false;
if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x
&& mousePos.y >= topExtent.y && mousePos.y <= btmExtent.y)
{
comp.isHovered = true;
#ifdef SHEDITOR
//if (SHSystemManager::GetSystem<SHEditor>()->editorState == SHEditor::State::PLAY)
{
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
{
comp.isClicked = true;
}
}
#else
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::LMB))
{
comp.isClicked = true;
}
#endif
//SHLOG_INFO("HOVERED")
}
else
{
comp.isHovered = false;
//SHLOG_INFO("NOT HOVERED")
}
if (comp.isClicked && SHInputManager::GetKeyUp(SHInputManager::SH_KEYCODE::LMB))
{
comp.isClicked = false;
comp.value = !comp.value; comp.value = !comp.value;
SHButtonClickEvent clickEvent;
clickEvent.EID = comp.GetEID();
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_CLICK_EVENT);
}
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID())) if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
{ {

View File

@ -73,6 +73,11 @@ namespace SHADE
void UpdateToggleButtonComponent(SHToggleButtonComponent& comp) noexcept; void UpdateToggleButtonComponent(SHToggleButtonComponent& comp) noexcept;
void UpdateCanvasComponent(SHCanvasComponent& comp) noexcept; void UpdateCanvasComponent(SHCanvasComponent& comp) noexcept;
//returns true on button release.
bool CheckButtonHoveredOrClicked(SHUIComponent& comp) noexcept;
SHVec2 CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept; SHVec2 CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept;