2023-10-05 02:39:41 +00:00
|
|
|
//
|
|
|
|
// Created by kyle on 2023-10-04.
|
|
|
|
//
|
2023-10-05 04:26:34 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include "Platform.h"
|
|
|
|
#include "GUI.h"
|
|
|
|
|
|
|
|
static void
|
|
|
|
glfw_error_callback(int error, const char *description)
|
|
|
|
{
|
|
|
|
cerr << "GLFW error " << error << ": " << description << std::endl;
|
|
|
|
}
|
|
|
|
|
2023-10-05 02:39:41 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, const char *argv[])
|
|
|
|
{
|
2023-10-05 04:26:34 +00:00
|
|
|
const char *glsl_version = "#version 130";
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
|
|
|
|
|
|
|
// Setup window
|
|
|
|
glfwSetErrorCallback(glfw_error_callback);
|
|
|
|
if (!glfwInit()) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window == NULL)
|
|
|
|
return 1;
|
|
|
|
glfwMakeContextCurrent(window);
|
|
|
|
glfwSwapInterval(1); // Enable vsync
|
|
|
|
|
|
|
|
bool err = glewInit() != GLEW_OK;
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
{
|
|
|
|
std::cerr << "Failed to initialize OpenGL loader!" << std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int screen_width, screen_height;
|
|
|
|
glfwGetFramebufferSize(window, &screen_width, &screen_height);
|
|
|
|
glViewport(0, 0, screen_width, screen_height);
|
|
|
|
|
|
|
|
|
|
|
|
IMGUI_CHECKVERSION();
|
|
|
|
ImGui::CreateContext(NULL);
|
|
|
|
ImGuiIO &io = ImGui::GetIO();
|
|
|
|
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
|
|
|
ImGui_ImplOpenGL3_Init(glsl_version);
|
2023-10-05 02:39:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|