#pragma once #include "dialogue/DialogueRuntime.h" #include "render/Renderer.h" #include "render/TextRenderer.h" #include "render/TextureManager.h" #include "render/UiQuad.h" #include "UiManager.h" #include #include #include namespace ZL::Dialogue { class DialogueOverlay { public: bool init(Renderer& renderer, const std::string& zipFile = ""); void update(const PresentationModel& model, int deltaMs); void draw(Renderer& renderer, const PresentationModel& model); void handlePointerDown(float x, float y, const PresentationModel& model); void handlePointerMoved(float x, float y, const PresentationModel& model); bool handlePointerReleased(float x, float y, const PresentationModel& model, int& outChoiceIndex, bool& outAdvanceDialogue); private: Renderer* rendererRef = nullptr; std::string zipFilename; std::shared_ptr textboxTexture; std::shared_ptr choiceMainTexture; std::shared_ptr choiceOptionalTexture; std::shared_ptr choiceSelectedTexture; mutable std::vector lastChoiceRects; mutable UiRect lastDialogueAdvanceRect{}; int hoveredChoiceIndex = -1; std::unique_ptr nameRenderer; std::unique_ptr bodyRenderer; std::unique_ptr choiceRenderer; UiQuad portraitQuad; UiQuad textboxQuad; mutable std::vector choiceQuads; std::shared_ptr loadTextureCached(const std::string& path); static std::string wrapTextToWidth(const std::string& input, const TextRenderer& textRenderer, float maxWidthPx, float scale); static bool rectContains(const UiRect& rect, float x, float y); }; } // namespace ZL::Dialogue