Added GLFWManager

This commit is contained in:
Pasha Bibko
2025-11-15 17:27:08 +00:00
parent 04ca0d1d69
commit e133929166
5 changed files with 96 additions and 22 deletions

View File

@@ -1,29 +1,16 @@
#include <vulkan/vulkan.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include "src/GLFWManager.h"
int main()
{
using namespace PB::Renderer; // Project namespace
/* Initializes GLFW and creates window */
if (!glfwInit())
{
std::cout << "Failed to initialize GLFW" << std::endl;
if (!GLFWManager::Init())
return -1;
}
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
const int WIDTH = 800;
const int HEIGHT = 600;
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan Window", nullptr, nullptr);
GLFWwindow* window = GLFWManager::CreateWindow(800, 600, "Vulkan window");
if (!window)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
/* Polls window events whilst it is still open */
while (!glfwWindowShouldClose(window))
@@ -32,6 +19,6 @@ int main()
}
/* Cleans up GLFW */
glfwDestroyWindow(window);
glfwTerminate();
}
if (!GLFWManager::Cleanup())
return -1;
}