[atom_cpu_profiler_gem_promotion] additional APIs for external control of the CPU profiler and visualization

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
AMZN-ScottR
2021-10-15 18:44:10 -07:00
parent 63e68f224b
commit 6480bc8b86
7 changed files with 58 additions and 7 deletions
@@ -61,13 +61,10 @@ namespace Profiler
{
}
void ProfilerImGuiSystemComponent::Init()
{
}
void ProfilerImGuiSystemComponent::Activate()
{
#if defined(IMGUI_ENABLED)
ProfilerImGuiRequestBus::Handler::BusConnect();
ImGui::ImGuiUpdateListenerBus::Handler::BusConnect();
#endif // defined(IMGUI_ENABLED)
}
@@ -75,16 +72,22 @@ namespace Profiler
void ProfilerImGuiSystemComponent::Deactivate()
{
#if defined(IMGUI_ENABLED)
ProfilerImGuiRequestBus::Handler::BusDisconnect();
ImGui::ImGuiUpdateListenerBus::Handler::BusDisconnect();
#endif // defined(IMGUI_ENABLED)
}
#if defined(IMGUI_ENABLED)
void ProfilerImGuiSystemComponent::ShowCpuProfilerWindow(bool& keepDrawing)
{
m_imguiCpuProfiler.Draw(keepDrawing);
}
void ProfilerImGuiSystemComponent::OnImGuiUpdate()
{
if (m_showCpuProfiler)
{
m_imguiCpuProfiler.Draw(m_showCpuProfiler);
ShowCpuProfilerWindow(m_showCpuProfiler);
}
}