From f6c8921132c5fe8ed930968f49afe7af995af6c6 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 7 Dec 2022 17:26:35 +0100 Subject: [PATCH] GridComponent item opacity is now adjusted for hidden entries and entries marked as not being games. --- .../src/components/primary/GridComponent.h | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/es-core/src/components/primary/GridComponent.h b/es-core/src/components/primary/GridComponent.h index 47ca1cba6..f07b1cfe9 100644 --- a/es-core/src/components/primary/GridComponent.h +++ b/es-core/src/components/primary/GridComponent.h @@ -525,20 +525,35 @@ template void GridComponent::render(const glm::mat4& parentTrans if (mLastCursor != mCursor) renderEntries.emplace_back(mCursor); - float opacity {mUnfocusedItemOpacity}; float scale {1.0f}; + float opacity {1.0f}; trans[3].y -= (mItemSize.y + mItemSpacing.y) * mScrollPos; mRenderer->setMatrix(trans); for (auto it = renderEntries.cbegin(); it != renderEntries.cend(); ++it) { + float metadataOpacity {1.0f}; + + if constexpr (std::is_same_v) { + // If a game is marked as hidden, lower the opacity a lot. + // If a game is marked to not be counted, lower the opacity a moderate amount. + if (mEntries.at(*it).object->getHidden()) + metadataOpacity = 0.4f; + else if (!mEntries.at(*it).object->getCountAsGame()) + metadataOpacity = 0.7f; + } + + opacity = mUnfocusedItemOpacity * metadataOpacity; + if (*it == static_cast(mCursor)) { scale = glm::mix(1.0f, mItemScale, mTransitionFactor); - opacity = glm::mix(mUnfocusedItemOpacity, 1.0f, mTransitionFactor); + opacity = glm::mix(mUnfocusedItemOpacity * metadataOpacity, 1.0f * metadataOpacity, + mTransitionFactor); } else if (*it == static_cast(mLastCursor)) { scale = glm::mix(mItemScale, 1.0f, mTransitionFactor); - opacity = glm::mix(1.0f, mUnfocusedItemOpacity, mTransitionFactor); + opacity = glm::mix(1.0f * metadataOpacity, mUnfocusedItemOpacity * metadataOpacity, + mTransitionFactor); } mEntries.at(*it).data.item->setScale(scale);