#include <gearlib.h>

int main() {
    Window window = create_window(800, 600, "textures");
    glfwSwapInterval(0); // fps unlock
    setup_quads();

    Camera* camera = create_camera(vec2(0.0f, 0.0f));
    UniformBuffer* camera_buffer = create_uniform_buffer(sizeof(CameraMatrices));

    double time = glfwGetTime();

    while (!glfwWindowShouldClose(window)) {
        process_input(window);
        update_camera(camera, window);
        set_uniform_data(camera_buffer, camera->m);

        glClearColor(vec4_spread(BLUE));
        glClear(GL_COLOR_BUFFER_BIT);

        draw_quad(vec2(10, 10), vec2(500, 500), RED);

        flush();

	double end_time = glfwGetTime();
	double frame_time = end_time - time;
	time = end_time;

	double fps = 1.0 / frame_time;
	printf("frame_time: %lf fps: %lf\n", frame_time, fps);
    
        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glfwDestroyWindow(window);
    glfwTerminate();
    return 0;
}