46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#ifndef EDITOR_CANVASVIEW_H
|
|
#define EDITOR_CANVASVIEW_H
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
#include <destrum/Components/UI/CanvasFrame.h>
|
|
|
|
class GameObject;
|
|
class RectGizmo;
|
|
class Scene;
|
|
struct ImDrawList;
|
|
|
|
class CanvasView final {
|
|
public:
|
|
[[nodiscard]] bool IsEnabled() const { return m_Enabled; }
|
|
void SetEnabled(bool enabled);
|
|
void Toggle() { SetEnabled(!m_Enabled); }
|
|
|
|
[[nodiscard]] bool ShowsScene() const { return m_ShowScene; }
|
|
[[nodiscard]] bool IsPanning() const { return m_Panning; }
|
|
[[nodiscard]] CanvasFrame GetFrame() const;
|
|
|
|
void SetDrawImageSize(const glm::vec2& size);
|
|
void Fit();
|
|
|
|
bool HandleInput(const glm::vec2& mousePixel, const glm::vec2& pixelsPerPoint, bool hovered);
|
|
void SubmitBackdrop() const;
|
|
void DrawOverlay(ImDrawList& drawList, const glm::vec2& viewMin, const glm::vec2& viewScale) const;
|
|
void DrawToolbar(RectGizmo& gizmo);
|
|
|
|
[[nodiscard]] static GameObject* Pick(Scene& scene, const glm::vec2& pixel);
|
|
|
|
private:
|
|
bool m_Enabled{false};
|
|
bool m_ShowScene{false};
|
|
bool m_Fitted{true};
|
|
bool m_Panning{false};
|
|
int m_Preset{0};
|
|
glm::ivec2 m_Resolution{1920, 1080};
|
|
glm::vec2 m_DrawImageSize{1.0f};
|
|
glm::vec2 m_FrameMin{0.0f};
|
|
float m_Zoom{1.0f};
|
|
};
|
|
|
|
#endif // EDITOR_CANVASVIEW_H
|