mirror of
https://github.com/RetroPie/EmulationStation.git
synced 2025-04-02 10:41:48 -04:00
Squashed commit of the following:
commit 895e176c513ca1556c60c5c29c85bd43da3675e0 Author: Gemba <uid0@sdf-eu.org> Date: Fri Aug 5 13:37:44 2022 +0200 Changes to allow rollover at gamelist edges instead of rolling back in 'slide' mode. Needs 'Transition Style' set to 'slide'. Needs 'Quick Navigation' in Gamelist view enabled.
This commit is contained in:
parent
34b2545b0d
commit
00577453d2
2 changed files with 46 additions and 8 deletions
|
@ -7,22 +7,21 @@
|
|||
class MoveCameraAnimation : public Animation
|
||||
{
|
||||
public:
|
||||
MoveCameraAnimation(Transform4x4f& camera, const Vector3f& target) : mCameraStart(camera), mTarget(target), cameraOut(camera) {}
|
||||
MoveCameraAnimation(Transform4x4f& camera, const Vector3f& target) : mCameraStart(camera), mTarget(target), mCameraOut(camera) { }
|
||||
|
||||
int getDuration() const override { return 400; }
|
||||
|
||||
void apply(float t) override
|
||||
{
|
||||
// cubic ease out
|
||||
t -= 1;
|
||||
cameraOut.translation() = -Vector3f().lerp(-mCameraStart.translation(), mTarget, t*t*t + 1);
|
||||
mCameraOut.translation() = -Vector3f().lerp(-mCameraStart.translation(), mTarget, t*t*t + 1 /*cubic ease out*/);
|
||||
}
|
||||
|
||||
private:
|
||||
Transform4x4f mCameraStart;
|
||||
Vector3f mTarget;
|
||||
|
||||
Transform4x4f& cameraOut;
|
||||
Transform4x4f& mCameraOut;
|
||||
};
|
||||
|
||||
#endif // ES_APP_ANIMATIONS_MOVE_CAMERA_ANIMATION_H
|
||||
|
|
|
@ -193,11 +193,50 @@ void ViewController::playViewTransition()
|
|||
}else{
|
||||
advanceAnimation(0, (int)(mFadeOpacity * FADE_DURATION));
|
||||
}
|
||||
} else if (transition_style == "slide"){
|
||||
}
|
||||
else if (transition_style == "slide")
|
||||
{
|
||||
// slide or simple slide
|
||||
setAnimation(new MoveCameraAnimation(mCamera, target));
|
||||
bool inGamelistNav = -mCamera.translation().y() == target.y() // not in/out gamelist nav
|
||||
&& -mCamera.translation().x() - target.x(); // left/right movement
|
||||
cancelAnimation(0);
|
||||
Vector3f tgt = Vector3f(target);
|
||||
Vector3f positionOrig;
|
||||
if (inGamelistNav) {
|
||||
const float screenWidth = (float)Renderer::getScreenWidth();
|
||||
if (-mCamera.translation().x() - tgt.x() >= 2 * screenWidth)
|
||||
{
|
||||
// right rollover
|
||||
mLockInput = true;
|
||||
tgt.x() = screenWidth * mGameListViews.size();
|
||||
}
|
||||
else if (-mCamera.translation().x() - tgt.x() <= 2 * -screenWidth)
|
||||
{
|
||||
// left rollover
|
||||
mLockInput = true;
|
||||
tgt.x() = -screenWidth;
|
||||
}
|
||||
// deny any further input on rollover as mCurrentView would be
|
||||
// different on subsequent animations, resulting in restoring
|
||||
// a unrelated mCurrentView/mCamera with the original position
|
||||
if (mLockInput)
|
||||
{
|
||||
positionOrig = Vector3f(mCurrentView->getPosition());
|
||||
mCurrentView->setPosition(tgt.x(), tgt.y());
|
||||
}
|
||||
}
|
||||
|
||||
setAnimation(new MoveCameraAnimation(mCamera, tgt), 0, [this, positionOrig] {
|
||||
if (mLockInput) {
|
||||
mCurrentView->setPosition(positionOrig);
|
||||
mCamera.translation() = -positionOrig;
|
||||
}
|
||||
mLockInput = false;
|
||||
});
|
||||
updateHelpPrompts(); // update help prompts immediately
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// instant
|
||||
setAnimation(new LambdaAnimation(
|
||||
[this, target](float /*t*/)
|
||||
|
|
Loading…
Add table
Reference in a new issue