#include "MyGraphicsEngine/Window.h" #include bool BarinkWindow::InitGLFW(){ if(!glfwInit()) { spdlog::error("Failed to initialise GLFW!"); return false; } return true; } BarinkWindow::BarinkWindow(const int width, const int height) : Width(width), Height(height), FullScreen(false){ if (InitGLFW()==false) { exit(-1); } window = glfwCreateWindow(Width, Height, "BarinkEngine", NULL, NULL); if( !window) { spdlog::error("GLFW failed to create window!"); glfwTerminate(); return; } glfwMakeContextCurrent(window); if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { printf("Failed to initialize GLAD!\n"); exit(-1); } VulkanSupported = glfwVulkanSupported(); glfwGetFramebufferSize(window, &Width, &Height); glViewport(0,0, Width, Height); glClearColor(0.2f, 0.2f, 0.2f, 1.0f); } BarinkWindow::~BarinkWindow(){ glfwTerminate(); } bool BarinkWindow::WindowShouldClose(){ return glfwWindowShouldClose(window); } void BarinkWindow::Poll() { glfwSwapBuffers(window); glfwPollEvents(); }