Added GLFWManager
This commit is contained in:
29
main.cpp
29
main.cpp
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user