mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 21:35:46 -04:00
Frontend: Display emulation speed
This commit is contained in:
@ -562,7 +562,17 @@ void SDLInterface::RenderMainMenuBar()
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 170.0f);
|
||||
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 205.0f);
|
||||
|
||||
const u32 rounded_speed = static_cast<u32>(std::round(m_speed));
|
||||
if (m_speed < 90.0f)
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f), "%u%%", rounded_speed);
|
||||
else if (m_speed < 110.0f)
|
||||
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 1.0f), "%u%%", rounded_speed);
|
||||
else
|
||||
ImGui::TextColored(ImVec4(0.4f, 1.0f, 0.4f, 1.0f), "%u%%", rounded_speed);
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 165.0f);
|
||||
ImGui::Text("FPS: %.2f", m_fps);
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 80.0f);
|
||||
@ -680,6 +690,11 @@ void SDLInterface::Run()
|
||||
m_fps = static_cast<float>(
|
||||
static_cast<double>(m_system->GetInternalFrameNumber() - m_last_internal_frame_number) / time);
|
||||
m_last_internal_frame_number = m_system->GetInternalFrameNumber();
|
||||
m_speed =
|
||||
static_cast<float>(static_cast<double>(m_system->GetGlobalTickCounter() - m_last_global_tick_counter) /
|
||||
(static_cast<double>(MASTER_CLOCK) * time)) *
|
||||
100.0f;
|
||||
m_last_global_tick_counter = m_system->GetGlobalTickCounter();
|
||||
m_fps_timer.Reset();
|
||||
}
|
||||
}
|
||||
|
@ -84,8 +84,10 @@ private:
|
||||
|
||||
float m_vps = 0.0f;
|
||||
float m_fps = 0.0f;
|
||||
float m_speed = 1.0f;
|
||||
u32 m_last_frame_number = 0;
|
||||
u32 m_last_internal_frame_number = 0;
|
||||
u32 m_last_global_tick_counter = 0;
|
||||
Timer m_fps_timer;
|
||||
|
||||
// UI options
|
||||
|
Reference in New Issue
Block a user