Fixed Buttons, Added Button events, Added Toggle Buttons, Added Sliders(WIP no graphics), Rework backend #308

Merged
maverickdgg merged 13 commits from SP3-20-UI-System into main 2023-01-16 14:11:51 +08:00
3 changed files with 8 additions and 8 deletions
Showing only changes of commit 28829213c9 - Show all commits

View File

@ -1,3 +1,3 @@
Name: UI Test Name: UI_Test
ID: 88543249 ID: 97161771
Type: 5 Type: 5

View File

@ -350,7 +350,7 @@ namespace SHADE
SHSerializationHelper::InitializeComponentFromNode<SHCanvasComponent>(componentsNode, eid); SHSerializationHelper::InitializeComponentFromNode<SHCanvasComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHButtonComponent>(componentsNode, eid); SHSerializationHelper::InitializeComponentFromNode<SHButtonComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHToggleButtonComponent>(componentsNode, eid); SHSerializationHelper::InitializeComponentFromNode<SHToggleButtonComponent>(componentsNode, eid);
SHSerializationHelper::ConvertNodeToComponent<SHTextRenderableComponent>(componentsNode, eid); //SHSerializationHelper::ConvertNodeToComponent<SHTextRenderableComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHTextRenderableComponent>(componentsNode, eid); SHSerializationHelper::InitializeComponentFromNode<SHTextRenderableComponent>(componentsNode, eid);
SHSerializationHelper::InitializeComponentFromNode<SHLightComponent>(componentsNode, eid); SHSerializationHelper::InitializeComponentFromNode<SHLightComponent>(componentsNode, eid);
} }

View File

@ -161,9 +161,9 @@ namespace SHADE
windowSize = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->windowSize; windowSize = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->windowSize;
mousePos = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->viewportMousePos; mousePos = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->viewportMousePos;
//mousePos.y = windowSize.y - mousePos.y; //mousePos.y = windowSize.y - mousePos.y;
SHLOG_INFO("mouse pos: {}, {}", mousePos.x, mousePos.y) //SHLOG_INFO("mouse pos: {}, {}", mousePos.x, mousePos.y)
mousePos /= windowSize; //mousePos /= windowSize;
SHLOG_INFO("mouse pos normalized: {}, {}", mousePos.x, mousePos.y) //SHLOG_INFO("mouse pos normalized: {}, {}", mousePos.x, mousePos.y)
#endif #endif
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0)}; SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0)};
@ -172,8 +172,8 @@ namespace SHADE
topExtent = CanvasToScreenPoint(topExtent); topExtent = CanvasToScreenPoint(topExtent);
btmExtent = CanvasToScreenPoint(btmExtent); btmExtent = CanvasToScreenPoint(btmExtent);
//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)
topExtent /= camSize; //topExtent /= camSize;
btmExtent /= camSize; //btmExtent /= camSize;
comp.isClicked = false; comp.isClicked = false;
if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x if (mousePos.x >= topExtent.x && mousePos.x <= btmExtent.x