#include <thread>
#include <Redacted3D/engine/engine.h>
#include <cube.h>
#include <ball.h>
#include <freeCam.h>
#include <demoSky.h>

int main()
{
    engine->window = new ReWindow::RWindow("Re3D Test Application", 1152, 864, RenderingAPI::OPENGL);
    engine->world = new(World);
    Engine::init();
    JGL::Update(engine->window->getSize());
    Fonts::initFonts();
    engine->window->setVsyncEnabled(false);
    engine->window->setResizable(false);
    engine->world->setAmbientLightColor(1.0f, 1.0f, 1.0f);
    Shader test("test", engine->workingDir + "/assets/shaders/defaultVertex.glsl", engine->workingDir + "/assets/shaders/defaultFragment.glsl");

    auto* camera = new(FreeCam);
    camera->name = "Camera";
    camera->SetPos({0.0f, -2.0f, -5.0f});
    camera->SetParent(engine->world);
    engine->world->setActiveCamera(camera);

    auto* cube = new(Cube);
    cube->name = "cube";
    cube->SetPos({-5, -2, 0});
    cube->SetParent(engine->world);

    auto* ball = new(Ball);
    ball->name = "sphere";
    ball->SetPos({5, -2, 0});
    ball->SetParent(engine->world);

    auto* skybox = new(DemoSkybox);
    skybox->setAngle(0,0,0);
    skybox->SetParent(engine->world);

    engine->renderLoop();
}

#ifdef WINDOWS_SMH
extern "C" {
    int wmain(int argc, wchar_t* argv[]) {
        return main();
    }
}
#endif
