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 5 additions and 5 deletions
Showing only changes of commit cdb5102630 - Show all commits

View File

@ -236,14 +236,14 @@ namespace SHADE
auto material = renderable->GetModifiableMaterial(); auto material = renderable->GetModifiableMaterial();
if(!comp.isHovered && !comp.isClicked) if(!comp.isHovered && !comp.isClicked)
if (SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE) if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
{ {
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) else if (comp.isClicked)
{ {
if (SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE) if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetClickedTexture()); material->SetProperty("data.textureIndex", comp.GetClickedTexture());
//SHLOG_INFO("SETTING CLICKED TEXTURE") //SHLOG_INFO("SETTING CLICKED TEXTURE")
@ -251,7 +251,7 @@ namespace SHADE
} }
else else
{ {
if (SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE) if (comp.GetHoveredTexture() != 0 && SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetHoveredTexture()); material->SetProperty("data.textureIndex", comp.GetHoveredTexture());
//SHLOG_INFO("SETTING HOVERED TEXTURE") //SHLOG_INFO("SETTING HOVERED TEXTURE")
@ -357,7 +357,7 @@ namespace SHADE
auto material = renderable->GetModifiableMaterial(); auto material = renderable->GetModifiableMaterial();
if (comp.GetValue() == false) if (comp.GetValue() == false)
{ {
if (SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE) if (comp.GetDefaultTexture()!= 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetDefaultTexture()); material->SetProperty("data.textureIndex", comp.GetDefaultTexture());
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")
@ -365,7 +365,7 @@ namespace SHADE
} }
else else
{ {
if (SHAssetManager::GetType(comp.GetToggledTexture()) == AssetType::TEXTURE) if (comp.GetToggledTexture() != 0 && SHAssetManager::GetType(comp.GetToggledTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetToggledTexture()); material->SetProperty("data.textureIndex", comp.GetToggledTexture());
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")