//
// Created by sfd on 25-5-25.
//

#ifndef EDITORLAYER_H
#define EDITORLAYER_H
#include <Hazel.h>

#include "Panels/ContentBroswerPanel.h"
#include "Panels/SceneHierachyPanel.h"

namespace Hazel
{
    class EditorLayer : public Layer
    {
    public:
        EditorLayer();
        virtual ~EditorLayer() = default;

        virtual void OnAttach() override;
        virtual void OnDetech() override;

        virtual void OnUpdate(TimeStep& ts) override;
        virtual void OnImGuiRender() override;
        virtual void OnEvent(SDL_Event& e) override;
    private:
        void SaveScene() const;
        void OpenScene();
        void OpenScene(const std::filesystem::path& scenePath);
        void NewScene();

        void ChangeOptMode(unsigned int mode);
    private:
        OrthographicCameraController m_CameraController;

        Ref<Texture2D> m_LogoTexture;
        Ref<Texture2D> m_CheckerBoardTexture;

        Ref<Scene> m_ActiveScene;
        EditorCamera m_EditorCamera;

        Entity m_HoveredEntity;

        glm::vec4 m_BackgroundColor = { 0.2f, 0.2f, 0.2f, 1.0f };
        glm::vec4 m_SquareColor = { 0.2f, 0.2f, 0.2f, 1.0f };

        bool m_ViewportFocused = false, m_ViewportHovered = false;
        glm::vec2 m_ViewPortSize = {0, 0};
        glm::vec2 m_ViewPortBounds[2];

        Ref<FrameBuffer> m_FrameBuffer;

        SceneHierachyPanel m_SceneHierachyPanel;
        ContentBroswerPanel m_ContentBroswerPanel;

        int m_GizmoType = 0;
    };
}


#endif //EDITORLAYER_H
