summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/OnScreenDisplay.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-06-24 10:43:46 +0200
committerPierre Bourdon <delroth@gmail.com>2016-06-24 10:43:46 +0200
commit3570c7f03a2aa90aa634f96c0af1969af610f14d (patch)
tree4252e03c0e853ba7cffe022937698c854ad0eaa9 /Source/Core/VideoCommon/OnScreenDisplay.cpp
parent2115e8a4a6814e32107b5205ff5c95bbd3c6e99c (diff)
Reformat all the things. Have fun with merge conflicts.
Diffstat (limited to 'Source/Core/VideoCommon/OnScreenDisplay.cpp')
-rw-r--r--Source/Core/VideoCommon/OnScreenDisplay.cpp79
1 files changed, 37 insertions, 42 deletions
diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp
index ebce4f79ea..3cc2e823d8 100644
--- a/Source/Core/VideoCommon/OnScreenDisplay.cpp
+++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp
@@ -15,20 +15,15 @@
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/RenderBase.h"
-
namespace OSD
{
-
struct Message
{
- Message() {}
- Message(const std::string& s, u32 ts, u32 rgba) : m_str(s), m_timestamp(ts), m_rgba(rgba)
- {
- }
-
- std::string m_str;
- u32 m_timestamp;
- u32 m_rgba;
+ Message() {}
+ Message(const std::string& s, u32 ts, u32 rgba) : m_str(s), m_timestamp(ts), m_rgba(rgba) {}
+ std::string m_str;
+ u32 m_timestamp;
+ u32 m_rgba;
};
static std::multimap<CallbackType, Callback> s_callbacks;
@@ -36,55 +31,55 @@ static std::list<Message> s_msgList;
void AddMessage(const std::string& str, u32 ms, u32 rgba)
{
- s_msgList.emplace_back(str, Common::Timer::GetTimeMs() + ms, rgba);
+ s_msgList.emplace_back(str, Common::Timer::GetTimeMs() + ms, rgba);
}
void DrawMessages()
{
- if (!SConfig::GetInstance().bOnScreenDisplayMessages)
- return;
-
- int left = 25, top = 15;
- auto it = s_msgList.begin();
- while (it != s_msgList.end())
- {
- int time_left = (int)(it->m_timestamp - Common::Timer::GetTimeMs());
- float alpha = std::max(1.0f, std::min(0.0f, time_left / 1024.0f));
- u32 color = (it->m_rgba & 0xFFFFFF) | ((u32)((it->m_rgba >> 24) * alpha) << 24);
-
- g_renderer->RenderText(it->m_str, left, top, color);
-
- top += 15;
-
- if (time_left <= 0)
- it = s_msgList.erase(it);
- else
- ++it;
- }
+ if (!SConfig::GetInstance().bOnScreenDisplayMessages)
+ return;
+
+ int left = 25, top = 15;
+ auto it = s_msgList.begin();
+ while (it != s_msgList.end())
+ {
+ int time_left = (int)(it->m_timestamp - Common::Timer::GetTimeMs());
+ float alpha = std::max(1.0f, std::min(0.0f, time_left / 1024.0f));
+ u32 color = (it->m_rgba & 0xFFFFFF) | ((u32)((it->m_rgba >> 24) * alpha) << 24);
+
+ g_renderer->RenderText(it->m_str, left, top, color);
+
+ top += 15;
+
+ if (time_left <= 0)
+ it = s_msgList.erase(it);
+ else
+ ++it;
+ }
}
void ClearMessages()
{
- s_msgList.clear();
+ s_msgList.clear();
}
// On-Screen Display Callbacks
void AddCallback(CallbackType type, Callback cb)
{
- s_callbacks.emplace(type, cb);
+ s_callbacks.emplace(type, cb);
}
void DoCallbacks(CallbackType type)
{
- auto it_bounds = s_callbacks.equal_range(type);
- for (auto it = it_bounds.first; it != it_bounds.second; ++it)
- {
- it->second();
- }
-
- // Wipe all callbacks on shutdown
- if (type == CallbackType::Shutdown)
- s_callbacks.clear();
+ auto it_bounds = s_callbacks.equal_range(type);
+ for (auto it = it_bounds.first; it != it_bounds.second; ++it)
+ {
+ it->second();
+ }
+
+ // Wipe all callbacks on shutdown
+ if (type == CallbackType::Shutdown)
+ s_callbacks.clear();
}
} // namespace