#include "GLFW/glfw3.h"
#include "LVK.h"
#include "minilog/minilog.h"
#include <memory>
#include <shared/HelpersGLFW.h>

int main(int argc, char *argv[]) {
  minilog::initialize(nullptr, {.threadNames = false});

  int width = 1280;
  int height = 720;

  GLFWwindow *window = lvk::initWindow("Ch04_04: CubeMap", width, height);
  std::unique_ptr<lvk::IContext> ctx =
      lvk::createVulkanContextWithSwapchain(window, width, height, {});

  while (!glfwWindowShouldClose(window)) {
    glfwPollEvents();
    glfwGetFramebufferSize(window, &width, &height);
    if (!width || !height)
      continue;
    lvk::ICommandBuffer &buf = ctx->acquireCommandBuffer();
    ctx->submit(buf, ctx->getCurrentSwapchainTexture());
  }

  ctx.reset();
  glfwDestroyWindow(window);
  glfwTerminate();
  return 0;
}
