blob: 87ded1662864dc74f01ba1da02f42a75dbebf004 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include "Game/UI/uiFadeProgress.h"
#include "Game/UI/uiUtils.h"
namespace uking::ui {
SEAD_SINGLETON_DISPOSER_IMPL(FadeProgress)
void FadeProgress::init() {
mActive = false;
mProgress = 0.0;
mGaugeValue = 0.0;
mSteps = 1.0;
}
void FadeProgress::reset() {
init();
}
void FadeProgress::updateFadeScreen() {
if (!mActive)
return;
float progress = mProgress;
float difference = progress - mGaugeValue;
if (difference > 0.1f)
mSteps = 1.1;
if (difference > 0.2f)
mSteps = 1.2;
if (progress > 0.94f)
mSteps = 10.0;
if (difference <= 0.0001f && difference >= -0.0001f)
mSteps = 1.0;
float new_progress = mGaugeValue + (mProgressPerStep * mSteps);
if (new_progress < progress)
progress = new_progress;
mGaugeValue = progress;
applyScreenFade(progress);
}
void FadeProgress::setProgress(float value) {
if (mProgress < value)
mProgress = value;
}
float FadeProgress::getGaugeValue() const {
return mGaugeValue;
}
void FadeProgress::setIsActive() {
mActive = true;
}
} // namespace uking::ui
|