//
// Created by sebastian on 30.07.26.
//

#ifndef COLORRACE_SCENEMANAGER_H
#define COLORRACE_SCENEMANAGER_H
#include <memory>

#include "Scene.h"
#include "core/inputsOutputs/context/InputContextStack.h"
#include "loader/AssetLoader.h"


namespace engine {
    class SceneManager {
    public:
        explicit SceneManager(InputContextStack& inputStack) :m_inputStack(inputStack) {}
        void switchTo(std::unique_ptr<Scene> scene, std::function<void()> onSceneLoaded = nullptr);
        void update(float deltaTime);
        void render() const;
        ~SceneManager() = default;

        [[nodiscard]] float getTransitionProgress() const;
    private:
        std::unique_ptr<Scene> currentScene;
        std::unique_ptr<Scene> nextScene;
        bool isTransitioning = false;
        std::function<void()> onSceneLoaded;
        AssetLoader assetLoader;

        InputContextStack& m_inputStack;
    };


}
#endif //COLORRACE_SCENEMANAGER_H
