vulkanTutorial/VulkanTutorial.cpp

49 lines
855 B
C++

// VulkanTutorial.cpp: 定义应用程序的入口点。
//
#include "VulkanTutorial.h"
GLFWwindow* HelloTriangleApplication::initWindow(int Width, int Height) {
glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
auto window = glfwCreateWindow(Width, Height, "vulkan", nullptr, nullptr);
return window;
}
void HelloTriangleApplication::mainLoop(GLFWwindow* window){
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
}
}
void HelloTriangleApplication::cleanup(GLFWwindow* window) {
glfwDestroyWindow(window);
glfwTerminate();
}
int main()
{
HelloTriangleApplication app;
int Width = 800;
int Height = 600;
try
{
app.run(Width,Height);
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}