mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Dialog: Fade in 200ms like the firmware, and accept input while fading in
On a PSP, dialog animations advance by animSpeed frames per Update and the fades take about 200ms. Ours took 500ms (1/30 s per animSpeed, over FADE_TIME 1.0), and all input was ignored until it finished, which made dialogs feel sluggish, noticeably so in 30fps games. Input is still ignored while fading out, once a choice has been made. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
cafbab50d9
commit
ec00700730
2 files changed
+12
-4
No files matched your search
@@ -33,7 +33,9 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/Util/PPGeDraw.h"
|
||||
|
||||
#define FADE_TIME 1.0
|
||||
// In seconds. On a PSP, dialog animations advance by animSpeed frames per Update and take about
|
||||
// this long.
|
||||
#define FADE_TIME 0.2
|
||||
|
||||
constexpr float FONT_SCALE = 0.55f;
|
||||
|
||||
@@ -218,7 +220,7 @@ void PSPDialog::StartFade(bool fadeIn_)
|
||||
|
||||
void PSPDialog::UpdateFade(int animSpeed) {
|
||||
if (isFading) {
|
||||
fadeTimer += 1.0f/30.0f * animSpeed; // Probably need a more real value of delta time
|
||||
fadeTimer += animSpeed / 60.0f;
|
||||
if (fadeTimer < FADE_TIME) {
|
||||
if (fadeIn)
|
||||
fadeValue = (u32) (fadeTimer / FADE_TIME * 255);
|
||||
@@ -286,15 +288,20 @@ void PSPDialog::UpdateButtons()
|
||||
buttons = __CtrlReadLatch();
|
||||
}
|
||||
|
||||
// Input is fine while fading in, but not while fading out: the choice has already been made.
|
||||
bool PSPDialog::IsFadingOut() const {
|
||||
return isFading && !fadeIn;
|
||||
}
|
||||
|
||||
bool PSPDialog::IsButtonPressed(int checkButton)
|
||||
{
|
||||
return !isFading && (buttons & checkButton);
|
||||
return !IsFadingOut() && (buttons & checkButton);
|
||||
}
|
||||
|
||||
bool PSPDialog::IsButtonHeld(int checkButton, int &framesHeld, int framesHeldThreshold, int framesHeldRepeatRate)
|
||||
{
|
||||
bool btnWasHeldLastFrame = (lastButtons & checkButton) && (__CtrlPeekButtons() & checkButton);
|
||||
if (!isFading && btnWasHeldLastFrame) {
|
||||
if (!IsFadingOut() && btnWasHeldLastFrame) {
|
||||
framesHeld++;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -86,6 +86,7 @@ protected:
|
||||
PPGeStyle FadedStyle(PPGeAlign align, float scale);
|
||||
PPGeImageStyle FadedImageStyle();
|
||||
void UpdateButtons();
|
||||
bool IsFadingOut() const;
|
||||
bool IsButtonPressed(int checkButton);
|
||||
bool IsButtonHeld(int checkButton, int &framesHeld, int framesHeldThreshold = 30, int framesHeldRepeatRate = 10);
|
||||
// The caption override is assumed to have a size of 64 bytes.
|
||||
|
||||
Reference in new issue
Block a user