Refactor editor host resource boundary
This commit is contained in:
45
editor/app/Host/Interfaces/EditorHostResourceService.h
Normal file
45
editor/app/Host/Interfaces/EditorHostResourceService.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Host {
|
||||
|
||||
enum class EditorHostPngResourceKind : std::uint8_t {
|
||||
FolderIcon = 0,
|
||||
GameObjectIcon,
|
||||
SceneIcon,
|
||||
Logo,
|
||||
LogoIcon,
|
||||
CameraGizmoIcon,
|
||||
DirectionalLightGizmoIcon,
|
||||
PointLightGizmoIcon,
|
||||
SpotLightGizmoIcon,
|
||||
PlayButtonIcon,
|
||||
PauseButtonIcon,
|
||||
StepButtonIcon,
|
||||
};
|
||||
|
||||
struct EditorHostResourceBytes {
|
||||
const std::uint8_t* data = nullptr;
|
||||
std::size_t size = 0u;
|
||||
|
||||
bool IsValid() const {
|
||||
return data != nullptr && size > 0u;
|
||||
}
|
||||
};
|
||||
|
||||
class EditorHostResourceService {
|
||||
public:
|
||||
virtual ~EditorHostResourceService() = default;
|
||||
|
||||
virtual bool TryLoadPngResource(
|
||||
EditorHostPngResourceKind kind,
|
||||
EditorHostResourceBytes& outBytes,
|
||||
std::string& outError) const = 0;
|
||||
virtual std::filesystem::path GetExecutableDirectory() const = 0;
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Host
|
||||
Reference in New Issue
Block a user