//
// Created by sebastian on 23.12.25.
//

#include "Application.h"

#include "../layer/Layer.h"

Application* Application::instance = nullptr;

void Application::pushLayer(Layer* layer) {
    layers.push_back(layer);
    layer->onAttach();
}

Application::Application()
{
    instance = this;

    WindowProps window_props = WindowProps();
    window_props.Width = 1280;
    window_props.Height = 720;
    window_props.Title = "DiceSettlers v0.0.1";
    window_props.VSync = true;

    window.reset(Window::Create(window_props));
}

Application::~Application()
{
}

void Application::run() {
    while (!window->shouldClose())
    {
        for (Layer* layer : layers)
        {
            layer->onUpdate();
        }
        window->OnUpdate();
    }
}

Application& Application::getInstance()
{
    return *instance;
}
