Newer
Older
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "Window.hpp"
#include "CoreManager.hpp"
namespace vkcv {
Window::Window(GLFWwindow *window)
: m_window(window) {
}
Window::~Window() {
glfwDestroyWindow(m_window);
vkcv::terminateGLFW();
}
Window Window::create(const char *windowTitle, int width, int height, bool resizable) {
vkcv::initGLFW();
width = width <= 0 ? 1 : width;
height = height <= 0 ? 1 : height;
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_RESIZABLE, resizable ? GLFW_TRUE : GLFW_FALSE);
GLFWwindow *window;
window = glfwCreateWindow(width, height, windowTitle, nullptr, nullptr);
return Window(window);
}
bool Window::isWindowOpen() const {
return !glfwWindowShouldClose(m_window);
}
void Window::pollEvents() {
glfwPollEvents();
}
GLFWwindow *Window::getWindow() const {
return m_window;
}
int Window::getWidth() const {
int width;
glfwGetWindowSize(m_window, &width, nullptr);
return width;
}
int Window::getHeight() const {
int height;
glfwGetWindowSize(m_window, nullptr, &height);
return height;
}
}