// IAEngine: 2D Game Engine by IA
// Copyright (C) 2025 IASoft (PVT) LTD (oss@iasoft.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

#pragma once

#include <IAEngine/Components/IComponent.hpp>

namespace ia::iae
{
    class CameraComponent : public IComponent
    {
      public:
        CameraComponent(IN Node2D *node);

      public:
        VOID Draw();
        VOID DebugDraw();

        VOID Update();
        VOID FixedUpdate();

      public:
        VOID SetViewport(IN INT32 width, IN INT32 height);

        Vec2& PositionOffset()
        {
            return m_positionOffset;
        }

        Vec4 GetViewport() CONST
        {
            return m_viewport;
        }

        CONST Mat4 *GetViewMatrix() CONST
        {
            return &m_viewMatrix;
        }

        CONST Mat4 *GetProjectionMatrix() CONST
        {
            return &m_projectionMatrix;
        }

      private:
        Vec4 m_viewport{};
        Mat4 m_viewMatrix{1.0f};
        Vec2 m_positionOffset{};
        Mat4 m_projectionMatrix{1.0f};
    };
} // namespace ia::iae
