-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglWindow.h
67 lines (55 loc) · 1.51 KB
/
glWindow.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include <iostream>
#include <string>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
/**
* @brief Class glWindow handles all GLFW window operations.
*/
class glWindow
{
public:
/**
* @brief Empty Constructor with default window settings.
*/
glWindow();
/**
* @brief Constructor to build GLFWwindow object according to params.
* @param title Title of window.
* @param width Width of window.
* @param height Height of window.
*/
glWindow(std::string title, GLint width, GLint height);
/**
* @brief Destructor
*/
~glWindow();
/**
* @brief Initialise new window.
*/
int initialise();
/**
* @brief Check whether window should close
*/
bool isShouldClose() { return glfwWindowShouldClose(window); }
/**
* @brief Swap buffers (front and back buffers)
*/
void swapBuffers() { glfwSwapBuffers(window); }
GLFWwindow* getGlWindow() { return window; }
GLfloat getBufferWidth() { return bufferWidth; }
GLfloat getBufferHeight() { return bufferHeight; }
private:
GLFWwindow* window;
std::string title;
GLint width, height;
GLint bufferWidth, bufferHeight;
static void staticFrameBufferSizeCallback(GLFWwindow* window, int width, int height);
/**
* @brief Handles resizing of window.
* @param window Window object.
* @param width Window width.
* @param height Window height.
*/
void frameBufferSizeCallback(GLFWwindow* window, int width, int height);
};