-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputTest.cpp
58 lines (43 loc) · 1.19 KB
/
inputTest.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
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
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <SOIL/SOIL.h>
#include <glm/glm.hpp>
#include <iostream>
#include "input.hpp"
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
class Window;
int main()
{
//using namespace sre;
using namespace std;
// Initialize GLEW
glewExperimental = GL_TRUE;
glewInit();
// Initialize GLFW
if ( !glfwInit() )
return -1;
GLFWwindow * win = glfwCreateWindow( 640, 480, "test", NULL, NULL );
//Window winDefault = Window();
//Window winCustom = Window( 800, 600, "custom window");
//winDefault.setActive();
//Window win = Window();
//glfwSetKeyCallback ( window.getGLFWWindow(), key_callback );
while( glfwWindowShouldClose(win) )
{
glfwSwapBuffers( win );
glfwPollEvents();
}
// Terminate GLFW
glfwTerminate();
}
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
class Window
{
GLFWwindow * window;
Window( int width, int height, string title, Monitor monitor, Window share);
Window( )
};