-
Notifications
You must be signed in to change notification settings - Fork 0
/
vulkan_window.cpp
30 lines (24 loc) · 1.08 KB
/
vulkan_window.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "vulkan_window.hpp"
namespace lve {
// implement the constructor
// member initialiser list to initialise the member variables
LveWindow::LveWindow(int h, int w, std::string name) : width{w}, height{h}, windowName{name} {
initWindow();
}
// destrcutor - destroy resources acquired at initialisation
LveWindow::~LveWindow() {
glfwDestroyWindow(window);
glfwTerminate();
}
// implement initWindow
void LveWindow::initWindow() {
glfwInit(); // initialise glfw library
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); // tell glfw not to create an opengl context (disable with 'no api')
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); // hint to disable window being resized after creation
// initialise the window pointer
// need to pass a c style string for the name
// fourth parameter is for making a full screen window (using nullptr for now)
// final paramter is related to opengl context
window = glfwCreateWindow(width, height, windowName.c_str(), nullptr, nullptr);
}
}