From 5d78412b9d494ab5b81ad31e8cb3694d7c83d033 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 5 Sep 2022 22:39:26 +0200 Subject: [PATCH] Fixed some pixel alignment issues for the carousel. --- es-app/src/views/SystemView.cpp | 3 ++- es-core/src/components/primary/CarouselComponent.h | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 4c01f5b06..46f46d311 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -1147,7 +1147,8 @@ void SystemView::legacyApplyTheme(const std::shared_ptr& theme) mPrimary->applyTheme(theme, "system", "textlist_gamelist", ThemeFlags::ALL); mLegacySystemInfo->setSize(mSize.x, mLegacySystemInfo->getFont()->getLetterHeight() * 2.2f); - mLegacySystemInfo->setPosition(0.0f, mPrimary->getPosition().y + mPrimary->getSize().y); + mLegacySystemInfo->setPosition(0.0f, std::round(mPrimary->getPosition().y) + + std::round(mPrimary->getSize().y)); mLegacySystemInfo->setBackgroundColor(0xDDDDDDD8); mLegacySystemInfo->setRenderBackground(true); mLegacySystemInfo->setFont( diff --git a/es-core/src/components/primary/CarouselComponent.h b/es-core/src/components/primary/CarouselComponent.h index 08b2b0c28..41bdcbe6c 100644 --- a/es-core/src/components/primary/CarouselComponent.h +++ b/es-core/src/components/primary/CarouselComponent.h @@ -498,10 +498,11 @@ template void CarouselComponent::render(const glm::mat4& parentT glm::mat4 carouselTrans {parentTrans}; carouselTrans = glm::translate( - carouselTrans, glm::vec3 {GuiComponent::mPosition.x, GuiComponent::mPosition.y, 0.0f}); - carouselTrans = - glm::translate(carouselTrans, glm::vec3 {GuiComponent::mOrigin.x * mSize.x * -1.0f, - GuiComponent::mOrigin.y * mSize.y * -1.0f, 0.0f}); + carouselTrans, + glm::round(glm::vec3 {GuiComponent::mPosition.x, GuiComponent::mPosition.y, 0.0f})); + carouselTrans = glm::translate( + carouselTrans, glm::round(glm::vec3 {GuiComponent::mOrigin.x * mSize.x * -1.0f, + GuiComponent::mOrigin.y * mSize.y * -1.0f, 0.0f})); mRenderer->pushClipRect( glm::ivec2 {static_cast(glm::clamp(std::round(carouselTrans[3].x), 0.0f, @@ -740,9 +741,9 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, const ThemeData::ThemeElement* elem {theme->getElement(view, element, "carousel")}; mSize.x = Renderer::getScreenWidth(); - mSize.y = Renderer::getScreenHeight() * 0.2325f; + mSize.y = Renderer::getScreenHeight() * 0.23240f; GuiComponent::mPosition.x = 0.0f; - GuiComponent::mPosition.y = floorf(0.5f * (Renderer::getScreenHeight() - mSize.y)); + GuiComponent::mPosition.y = Renderer::getScreenHeight() * 0.38378f; mCarouselColor = 0xFFFFFFD8; mCarouselColorEnd = 0xFFFFFFD8; mZIndex = mDefaultZIndex;