diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2018-05-11 18:33:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-11 18:33:45 +0200 |
| commit | b10bbea393d4415e98739889de2def236500fedf (patch) | |
| tree | 6655ff7f27ebb69b7667dbfcc63e330f91e465dc /Source/Core/VideoCommon | |
| parent | 082573bd6b4e8e9ce70a8839a83e0c5380b487b0 (diff) | |
| parent | 16e2ac925731812b990ccb8a1d4019691c54e563 (diff) | |
Merge pull request #6815 from spycrab/osd_refactor
VideoCommon/RenderBase: Refactor OSD messages
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.cpp | 22 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.h | 17 |
2 files changed, 26 insertions, 13 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 76d40f5aa3..33e449b56c 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -68,8 +68,6 @@ // TODO: Move these out of here. int frameCount; -int OSDChoice; -static int OSDTime; std::unique_ptr<Renderer> g_renderer; @@ -85,9 +83,6 @@ Renderer::Renderer(int backbuffer_width, int backbuffer_height) UpdateDrawRectangle(); CalculateTargetSize(); - OSDChoice = 0; - OSDTime = 0; - if (SConfig::GetInstance().bWii) m_aspect_wide = Config::Get(Config::SYSCONF_WIDESCREEN); @@ -296,13 +291,13 @@ void Renderer::DrawDebugText() } // OSD Menu messages - if (OSDChoice > 0) + if (m_osd_message > 0) { - OSDTime = Common::Timer::GetTimeMs() + 3000; - OSDChoice = -OSDChoice; + m_osd_time = Common::Timer::GetTimeMs() + 3000; + m_osd_message = -m_osd_message; } - if ((u32)OSDTime > Common::Timer::GetTimeMs()) + if (static_cast<u32>(m_osd_time) > Common::Timer::GetTimeMs()) { std::string res_text; switch (g_ActiveConfig.iEFBScale) @@ -360,7 +355,7 @@ void Renderer::DrawDebugText() // The latest changed setting in yellow for (int i = 0; i != lines_count; ++i) { - if (OSDChoice == -i - 1) + if (m_osd_message == -i - 1) final_yellow += lines[i]; final_yellow += '\n'; } @@ -368,7 +363,7 @@ void Renderer::DrawDebugText() // The other settings in cyan for (int i = 0; i != lines_count; ++i) { - if (OSDChoice != -i - 1) + if (m_osd_message != -i - 1) final_cyan += lines[i]; final_cyan += '\n'; } @@ -1032,3 +1027,8 @@ std::unique_ptr<VideoCommon::AsyncShaderCompiler> Renderer::CreateAsyncShaderCom { return std::make_unique<VideoCommon::AsyncShaderCompiler>(); } + +void Renderer::ShowOSDMessage(OSDMessage message) +{ + m_osd_message = static_cast<s32>(message); +} diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 2f3a28414d..62642d0e77 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -53,9 +53,17 @@ struct EfbPokeData u32 data; }; -// TODO: Move these out of here. extern int frameCount; -extern int OSDChoice; + +enum class OSDMessage : s32 +{ + IRChanged = 1, + ARToggled = 2, + EFBCopyToggled = 3, + FogToggled = 4, + SpeedChanged = 5, + XFBChanged = 6 +}; // Renderer really isn't a very good name for this class - it's more like "Misc". // The long term goal is to get rid of this class and replace it with others that make @@ -190,6 +198,8 @@ public: { } + void ShowOSDMessage(OSDMessage message); + protected: std::tuple<int, int> CalculateTargetScale(int x, int y) const; bool CalculateTargetSize(); @@ -277,6 +287,9 @@ private: u32 m_last_xfb_width = MAX_XFB_WIDTH; u32 m_last_xfb_height = MAX_XFB_HEIGHT; + s32 m_osd_message = 0; + s32 m_osd_time = 0; + // NOTE: The methods below are called on the framedumping thread. bool StartFrameDumpToAVI(const FrameDumpConfig& config); void DumpFrameToAVI(const FrameDumpConfig& config); |
