Added Changing of textures for buttons. Change button events to be on release #311

Merged
maverickdgg merged 4 commits from SP3-20-UI-System into main 2023-01-16 15:01:51 +08:00
1 changed files with 11 additions and 12 deletions
Showing only changes of commit 1e351366af - Show all commits

View File

@ -232,7 +232,7 @@ namespace SHADE
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
{
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
auto material = renderable->GetModifiableMaterial();
if(!comp.isHovered && !comp.isClicked)
@ -240,9 +240,16 @@ namespace SHADE
{
material->SetProperty("data.textureIndex", comp.GetDefaultTexture());
//SHLOG_INFO("SETTING DEFAULT TEXTURE")
}
else if (comp.isClicked)
{
if (SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
{
material->SetProperty("data.textureIndex", comp.GetClickedTexture());
//SHLOG_INFO("SETTING CLICKED TEXTURE")
}
}
if (comp.isHovered)
else
{
if (SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE)
{
@ -250,14 +257,6 @@ namespace SHADE
//SHLOG_INFO("SETTING HOVERED TEXTURE")
}
}
else
{
if (SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
{
material->SetProperty("data.textureIndex", comp.GetClickedTexture());
SHLOG_INFO("SETTING CLICKED TEXTURE")
}
}
@ -353,7 +352,7 @@ namespace SHADE
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
{
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
auto material = renderable->GetModifiableMaterial();
if (comp.GetValue() == false)