Magpie/Runtime/OverlayDrawer.h
2022-04-25 15:43:00 +08:00

49 lines
744 B
C++

#pragma once
#include "pch.h"
#include <deque>
struct ImFont;
class ImGuiImpl;
class OverlayDrawer {
public:
OverlayDrawer();
OverlayDrawer(const OverlayDrawer&) = delete;
OverlayDrawer(OverlayDrawer&&) = delete;
~OverlayDrawer();
bool Initialize();
void Draw();
bool IsUIVisiable() const noexcept {
return _isUIVisiable;
}
void SetUIVisibility(bool value);
private:
void _DrawFPS();
void _DrawUI();
void _RetrieveHardwareInfo();
float _dpiScale = 1.0f;
bool _isUIVisiable = false;
ImFont* _fontUI = nullptr;
ImFont* _fontFPS = nullptr;
std::deque<float> _frameTimes;
UINT _validFrames = 0;
struct {
std::string gpuName;
std::string cpuName;
} _hardwareInfo;
std::unique_ptr<ImGuiImpl> _imguiImpl;
};