[atom_cpu_profiler_gem_promotion] added optional AZ::Interface usage to ProfilerImGuiRequests

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
monroegm-disable-blank-issue-2
AMZN-ScottR 4 years ago
parent 6480bc8b86
commit fa4e91b05c

@ -8,6 +8,7 @@
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/Interface/Interface.h>
namespace Profiler
{
@ -31,5 +32,6 @@ namespace Profiler
static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
};
using ProfilerImGuiInterface = AZ::Interface<ProfilerImGuiRequests>;
using ProfilerImGuiRequestBus = AZ::EBus<ProfilerImGuiRequests, ProfilerImGuiBusTraits>;
} // namespace Profiler

@ -55,10 +55,22 @@ namespace Profiler
ProfilerImGuiSystemComponent::ProfilerImGuiSystemComponent()
{
#if defined(IMGUI_ENABLED)
if (ProfilerImGuiInterface::Get() == nullptr)
{
ProfilerImGuiInterface::Register(this);
}
#endif // defined(IMGUI_ENABLED)
}
ProfilerImGuiSystemComponent::~ProfilerImGuiSystemComponent()
{
#if defined(IMGUI_ENABLED)
if (ProfilerImGuiInterface::Get() == this)
{
ProfilerImGuiInterface::Unregister(this);
}
#endif // defined(IMGUI_ENABLED)
}
void ProfilerImGuiSystemComponent::Activate()

Loading…
Cancel
Save