#pragma once

#include "graphics/renderer.hpp"
#include "graphics/assets.hpp"
#include "graphics/mesh.hpp"

#include "os/window.hpp"
#include "os/input.hpp"

#include "utils/ptr.hpp"

#include "state.hpp"
#include "base_game.hpp"
#include "settings.hpp"
#include "camera.hpp"
#include "scene_manager.hpp"


#include <memory>       // unique_ptr


namespace frog
{


class engine
{
    os::GLFW glfw{};
    os::window window;
    gl::renderer renderer;

    frog::camera camera{ 100, 0.1, 100 };

    ptr<scene_manager> scenes = mk_ptr<scene_manager>();
    ptr<os::input> input = mk_ptr<os::input>();
    ptr<state> global;
    ptr<base_game> game;

    gl::assets<gl::mesh> meshes;
    gl::assets<gl::program> programs;

    void render(double between);

    void update_controls();

    void init();

    void stable_update();

    void frame_update();

public:

    engine(settings set, ptr<state> global);

    void play();

};


} // namespace frog
