mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Added rounding to various translations like camera movements.
This commit is contained in:
parent
881b602cb4
commit
ff0e76332c
|
@ -1194,14 +1194,16 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
||||||
mCarousel->getType() ==
|
mCarousel->getType() ==
|
||||||
CarouselComponent<SystemData*>::CarouselType::HORIZONTAL_WHEEL)
|
CarouselComponent<SystemData*>::CarouselType::HORIZONTAL_WHEEL)
|
||||||
elementTrans = glm::translate(
|
elementTrans = glm::translate(
|
||||||
elementTrans, glm::vec3 {(i - mCamOffset) * mSize.x, 0.0f, 0.0f});
|
elementTrans,
|
||||||
|
glm::round(glm::vec3 {(i - mCamOffset) * mSize.x, 0.0f, 0.0f}));
|
||||||
else
|
else
|
||||||
elementTrans = glm::translate(
|
elementTrans = glm::translate(
|
||||||
elementTrans, glm::vec3 {0.0f, (i - mCamOffset) * mSize.y, 0.0f});
|
elementTrans,
|
||||||
|
glm::round(glm::vec3 {0.0f, (i - mCamOffset) * mSize.y, 0.0f}));
|
||||||
}
|
}
|
||||||
else if (mTextList != nullptr) {
|
else if (mTextList != nullptr) {
|
||||||
elementTrans = glm::translate(elementTrans,
|
elementTrans = glm::translate(
|
||||||
glm::vec3 {0.0f, (i - mCamOffset) * mSize.y, 0.0f});
|
elementTrans, glm::round(glm::vec3 {0.0f, (i - mCamOffset) * mSize.y, 0.0f}));
|
||||||
}
|
}
|
||||||
|
|
||||||
mRenderer->pushClipRect(
|
mRenderer->pushClipRect(
|
||||||
|
|
|
@ -354,7 +354,7 @@ void ViewController::goToSystemView(SystemData* system, bool playTransition)
|
||||||
|
|
||||||
// Application startup animation.
|
// Application startup animation.
|
||||||
if (applicationStartup) {
|
if (applicationStartup) {
|
||||||
mCamera = glm::translate(mCamera, -mCurrentView->getPosition());
|
mCamera = glm::translate(mCamera, glm::round(-mCurrentView->getPosition()));
|
||||||
if (Settings::getInstance()->getString("TransitionStyle") == "slide") {
|
if (Settings::getInstance()->getString("TransitionStyle") == "slide") {
|
||||||
if (getSystemListView()->getPrimaryType() == SystemView::PrimaryType::CAROUSEL) {
|
if (getSystemListView()->getPrimaryType() == SystemView::PrimaryType::CAROUSEL) {
|
||||||
if (getSystemListView()->getCarouselType() ==
|
if (getSystemListView()->getCarouselType() ==
|
||||||
|
@ -540,7 +540,7 @@ void ViewController::goToGamelist(SystemData* system)
|
||||||
|
|
||||||
// Application startup animation, if starting in a gamelist rather than in the system view.
|
// Application startup animation, if starting in a gamelist rather than in the system view.
|
||||||
if (mState.viewing == NOTHING) {
|
if (mState.viewing == NOTHING) {
|
||||||
mCamera = glm::translate(mCamera, -mCurrentView->getPosition());
|
mCamera = glm::translate(mCamera, glm::round(-mCurrentView->getPosition()));
|
||||||
if (Settings::getInstance()->getString("TransitionStyle") == "slide") {
|
if (Settings::getInstance()->getString("TransitionStyle") == "slide") {
|
||||||
mCamera[3].y -= Renderer::getScreenHeight();
|
mCamera[3].y -= Renderer::getScreenHeight();
|
||||||
updateHelpPrompts();
|
updateHelpPrompts();
|
||||||
|
|
|
@ -229,9 +229,9 @@ const glm::mat4& GuiComponent::getTransform()
|
||||||
mTransform = glm::translate(mTransform, glm::vec3 {xOff, yOff, 0.0f});
|
mTransform = glm::translate(mTransform, glm::vec3 {xOff, yOff, 0.0f});
|
||||||
}
|
}
|
||||||
|
|
||||||
mTransform =
|
mTransform = glm::translate(
|
||||||
glm::translate(mTransform, glm::vec3 {std::round(mOrigin.x * mSize.x * -1.0f),
|
mTransform,
|
||||||
std::round(mOrigin.y * mSize.y * -1.0f), 0.0f});
|
glm::round(glm::vec3 {mOrigin.x * mSize.x * -1.0f, mOrigin.y * mSize.y * -1.0f, 0.0f}));
|
||||||
|
|
||||||
return mTransform;
|
return mTransform;
|
||||||
}
|
}
|
||||||
|
|
|
@ -613,7 +613,7 @@ void Window::renderLoadingScreen(std::string text)
|
||||||
|
|
||||||
float x {std::round((Renderer::getScreenWidth() - cache->metrics.size.x) / 2.0f)};
|
float x {std::round((Renderer::getScreenWidth() - cache->metrics.size.x) / 2.0f)};
|
||||||
float y {std::round(Renderer::getScreenHeight() * 0.835f)};
|
float y {std::round(Renderer::getScreenHeight() * 0.835f)};
|
||||||
trans = glm::translate(trans, glm::vec3 {x, y, 0.0f});
|
trans = glm::translate(trans, glm::round(glm::vec3 {x, y, 0.0f}));
|
||||||
mRenderer->setMatrix(trans);
|
mRenderer->setMatrix(trans);
|
||||||
font->renderTextCache(cache);
|
font->renderTextCache(cache);
|
||||||
delete cache;
|
delete cache;
|
||||||
|
|
|
@ -27,9 +27,9 @@ public:
|
||||||
void apply(float t) override
|
void apply(float t) override
|
||||||
{
|
{
|
||||||
t -= 1;
|
t -= 1;
|
||||||
cameraPosition[3].x = -glm::mix(-mCameraStart[3].x, mTarget.x, t * t * t + 1);
|
cameraPosition[3].x = std::round(-glm::mix(-mCameraStart[3].x, mTarget.x, t * t * t + 1));
|
||||||
cameraPosition[3].y = -glm::mix(-mCameraStart[3].y, mTarget.y, t * t * t + 1);
|
cameraPosition[3].y = std::round(-glm::mix(-mCameraStart[3].y, mTarget.y, t * t * t + 1));
|
||||||
cameraPosition[3].z = -glm::mix(-mCameraStart[3].z, mTarget.z, t * t * t + 1);
|
cameraPosition[3].z = std::round(-glm::mix(-mCameraStart[3].z, mTarget.z, t * t * t + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -180,7 +180,7 @@ void DateTimeEditComponent::render(const glm::mat4& parentTrans)
|
||||||
|
|
||||||
if (mAlignRight)
|
if (mAlignRight)
|
||||||
off.x += referenceSize - mTextCache->metrics.size.x;
|
off.x += referenceSize - mTextCache->metrics.size.x;
|
||||||
trans = glm::translate(trans, off);
|
trans = glm::translate(trans, glm::round(off));
|
||||||
|
|
||||||
mRenderer->setMatrix(trans);
|
mRenderer->setMatrix(trans);
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,8 @@ void TextEditComponent::render(const glm::mat4& parentTrans)
|
||||||
|
|
||||||
// Text + cursor rendering.
|
// Text + cursor rendering.
|
||||||
// Offset into our "text area" (padding).
|
// Offset into our "text area" (padding).
|
||||||
trans = glm::translate(trans, glm::vec3 {getTextAreaPos().x, getTextAreaPos().y, 0.0f});
|
trans =
|
||||||
|
glm::translate(trans, glm::round(glm::vec3 {getTextAreaPos().x, getTextAreaPos().y, 0.0f}));
|
||||||
|
|
||||||
glm::ivec2 clipPos {static_cast<int>(trans[3].x), static_cast<int>(trans[3].y)};
|
glm::ivec2 clipPos {static_cast<int>(trans[3].x), static_cast<int>(trans[3].y)};
|
||||||
// Use "text area" size for clipping.
|
// Use "text area" size for clipping.
|
||||||
|
@ -307,7 +308,7 @@ void TextEditComponent::render(const glm::mat4& parentTrans)
|
||||||
static_cast<int>(dimScaled.y - trans[3].y)};
|
static_cast<int>(dimScaled.y - trans[3].y)};
|
||||||
mRenderer->pushClipRect(clipPos, clipDim);
|
mRenderer->pushClipRect(clipPos, clipDim);
|
||||||
|
|
||||||
trans = glm::translate(trans, glm::vec3 {-mScrollOffset.x, -mScrollOffset.y, 0.0f});
|
trans = glm::translate(trans, glm::round(glm::vec3 {-mScrollOffset.x, -mScrollOffset.y, 0.0f}));
|
||||||
mRenderer->setMatrix(trans);
|
mRenderer->setMatrix(trans);
|
||||||
|
|
||||||
if (mTextCache)
|
if (mTextCache)
|
||||||
|
|
Loading…
Reference in a new issue