fix clicked texture to take priority over hovered texture
This commit is contained in:
parent
077f6f0fc9
commit
1e351366af
|
@ -232,7 +232,7 @@ namespace SHADE
|
||||||
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());
|
||||||
auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
|
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
|
||||||
|
|
||||||
auto material = renderable->GetModifiableMaterial();
|
auto material = renderable->GetModifiableMaterial();
|
||||||
if(!comp.isHovered && !comp.isClicked)
|
if(!comp.isHovered && !comp.isClicked)
|
||||||
|
@ -240,9 +240,16 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
material->SetProperty("data.textureIndex", comp.GetDefaultTexture());
|
material->SetProperty("data.textureIndex", comp.GetDefaultTexture());
|
||||||
//SHLOG_INFO("SETTING DEFAULT TEXTURE")
|
//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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (comp.isHovered)
|
|
||||||
{
|
{
|
||||||
if (SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE)
|
if (SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE)
|
||||||
{
|
{
|
||||||
|
@ -250,14 +257,6 @@ namespace SHADE
|
||||||
//SHLOG_INFO("SETTING HOVERED TEXTURE")
|
//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()))
|
if (SHComponentManager::HasComponent<SHRenderable>(comp.GetEID()))
|
||||||
{
|
{
|
||||||
auto renderable = SHComponentManager::GetComponent_s<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();
|
auto material = renderable->GetModifiableMaterial();
|
||||||
if (comp.GetValue() == false)
|
if (comp.GetValue() == false)
|
||||||
|
|
Loading…
Reference in New Issue