53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#ifndef NOMINMAX
|
|
#define NOMINMAX
|
|
#endif
|
|
|
|
#include <XCEngine/UI/DrawData.h>
|
|
|
|
#include <cstdint>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace XCEngine::UI::Editor::Host {
|
|
|
|
class NativeRenderer;
|
|
|
|
class AutoScreenshotController {
|
|
public:
|
|
void Initialize(const std::filesystem::path& captureRoot);
|
|
void Shutdown();
|
|
|
|
void RequestCapture(std::string reason);
|
|
void CaptureIfRequested(
|
|
NativeRenderer& renderer,
|
|
const ::XCEngine::UI::UIDrawData& drawData,
|
|
unsigned int width,
|
|
unsigned int height,
|
|
bool framePresented);
|
|
|
|
bool HasPendingCapture() const;
|
|
const std::filesystem::path& GetLatestCapturePath() const;
|
|
const std::string& GetLastCaptureSummary() const;
|
|
const std::string& GetLastCaptureError() const;
|
|
|
|
private:
|
|
std::filesystem::path BuildHistoryCapturePath(std::string_view reason) const;
|
|
|
|
static std::string BuildTimestampString();
|
|
static std::string SanitizeReason(std::string_view reason);
|
|
|
|
std::filesystem::path m_captureRoot = {};
|
|
std::filesystem::path m_historyRoot = {};
|
|
std::filesystem::path m_latestCapturePath = {};
|
|
std::string m_pendingReason = {};
|
|
std::string m_lastCaptureSummary = {};
|
|
std::string m_lastCaptureError = {};
|
|
std::uint64_t m_captureCount = 0;
|
|
bool m_capturePending = false;
|
|
};
|
|
|
|
} // namespace XCEngine::UI::Editor::Host
|