mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Implement more OSD types (challenge, progress indicators). Not really tested.
This commit is contained in:
1 parent
0889e7cf3e
commit
9e4387c529
7 files changed
+226
-83
No files matched your search
+50
-2
@@ -134,6 +134,54 @@ void OnScreenDisplay::ShowAchievementProgress(int achievementID, float duration_
|
||||
sideEntries_.insert(sideEntries_.begin(), entry);
|
||||
}
|
||||
|
||||
void OnScreenDisplay::ShowChallengeIndicator(int achievementID, bool show) {
|
||||
double now = time_now_d();
|
||||
|
||||
for (auto &entry : sideEntries_) {
|
||||
if (entry.numericID == achievementID && entry.type == OSDType::ACHIEVEMENT_CHALLENGE_INDICATOR && !show) {
|
||||
// Hide and eventually delete it.
|
||||
entry.endTime = now + (double)FadeoutTime();
|
||||
// Found it, we're done.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// OK, let's make a new side-entry.
|
||||
Entry entry;
|
||||
entry.numericID = achievementID;
|
||||
entry.type = OSDType::ACHIEVEMENT_CHALLENGE_INDICATOR;
|
||||
entry.startTime = now;
|
||||
entry.endTime = now + 10000000.0; // Don't auto-fadeout.
|
||||
sideEntries_.insert(sideEntries_.begin(), entry);
|
||||
}
|
||||
|
||||
void OnScreenDisplay::ShowLeaderboardTracker(int leaderboardTrackerID, const char *trackerText, bool show) { // show=true is used both for create and update.
|
||||
double now = time_now_d();
|
||||
|
||||
for (auto &entry : sideEntries_) {
|
||||
if (entry.numericID == leaderboardTrackerID && entry.type == OSDType::LEADERBOARD_TRACKER) {
|
||||
if (show) {
|
||||
// Just an update.
|
||||
entry.text = trackerText;
|
||||
} else {
|
||||
// Keep the current text, hide and eventually delete it.
|
||||
entry.endTime = now + (double)FadeoutTime();
|
||||
}
|
||||
// Found it, we're done.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// OK, let's make a new side-entry.
|
||||
Entry entry;
|
||||
entry.numericID = leaderboardTrackerID;
|
||||
entry.type = OSDType::LEADERBOARD_TRACKER;
|
||||
entry.startTime = now;
|
||||
entry.endTime = now + 10000000.0; // Don't auto-fadeout
|
||||
entry.text = trackerText;
|
||||
sideEntries_.insert(sideEntries_.begin(), entry);
|
||||
}
|
||||
|
||||
void OnScreenDisplay::ShowOnOff(const std::string &message, bool on, float duration_s) {
|
||||
// TODO: translate "on" and "off"? Or just get rid of this whole thing?
|
||||
Show(OSDType::MESSAGE_INFO, message + ": " + (on ? "on" : "off"), duration_s);
|
||||
@@ -164,12 +212,12 @@ void OnScreenDisplay::SetProgressBar(std::string id, std::string &&message, int
|
||||
bars_.push_back(bar);
|
||||
}
|
||||
|
||||
void OnScreenDisplay::RemoveProgressBar(std::string id, float fadeout_s) {
|
||||
void OnScreenDisplay::RemoveProgressBar(std::string id) {
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
for (auto iter = bars_.begin(); iter != bars_.end(); iter++) {
|
||||
if (iter->id == id) {
|
||||
iter->progress = iter->maxValue;
|
||||
iter->endTime = time_now_d() + (double)fadeout_s;
|
||||
iter->endTime = time_now_d() + FadeoutTime();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user