Files
XCEngine/new_editor/src/XCUIBackend/ImGuiTextAtlasProvider.h

36 lines
1.1 KiB
C
Raw Normal View History

2026-04-05 04:55:25 +08:00
#pragma once
#include "IXCUITextAtlasProvider.h"
struct ImGuiContext;
namespace XCEngine {
namespace Editor {
namespace XCUIBackend {
class ImGuiTextAtlasProvider final : public IXCUITextAtlasProvider {
public:
ImGuiTextAtlasProvider() = default;
explicit ImGuiTextAtlasProvider(::ImGuiContext* context);
void SetContext(::ImGuiContext* context);
::ImGuiContext* GetContext() const;
bool GetAtlasTextureView(PixelFormat preferredFormat, AtlasTextureView& outView) const override;
std::size_t GetFontCount() const override;
FontHandle GetFont(std::size_t index) const override;
FontHandle GetDefaultFont() const override;
bool GetFontInfo(FontHandle font, FontInfo& outInfo) const override;
bool GetBakedFontInfo(FontHandle font, float fontSize, BakedFontInfo& outInfo) const override;
bool FindGlyph(FontHandle font, float fontSize, std::uint32_t codepoint, GlyphInfo& outInfo) const override;
private:
::ImGuiContext* ResolveContext() const;
::ImGuiContext* m_context = nullptr;
};
} // namespace XCUIBackend
} // namespace Editor
} // namespace XCEngine