-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindow.h
43 lines (34 loc) · 1.01 KB
/
Window.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
#pragma once
#include "stdio.h"
#include <GL/glew.h>
#include <GLFW/glfw3.h>
class Window
{
public:
Window();
Window(GLint windowWidth, GLint windowHeight);
int Initialise();
GLfloat getBufferWidth() { return bufferWidth; }
GLfloat getBufferHeight() { return bufferHeight; }
GLfloat getXChange();
GLfloat getYChange();
bool getShouldClose() { return glfwWindowShouldClose(mainWindow); }
bool* getKeys() { return keys; }
void swapBuffers() { glfwSwapBuffers(mainWindow); }
~Window();
private:
GLFWwindow* mainWindow;
GLint width, height;
GLint bufferWidth, bufferHeight;
// Last coordinates of the mouse
GLfloat lastX;
GLfloat lastY;
// We can get the difference between the last and the current coordinates to get the how much things change
GLfloat xChange;
GLfloat yChange;
bool mousedFirstMoved;
bool keys[1024];
void CreateCallbacks();
static void handleKeys(GLFWwindow* window, int key, int code, int action, int mode);
static void handleMouse(GLFWwindow* window, double xPos, double yPos);
};