-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnglWindow.h
78 lines (53 loc) · 1.41 KB
/
nglWindow.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
68
69
70
71
72
73
74
75
76
77
78
#ifndef nglWindow_h__
#define nglWindow_h__
#include <ostream>
// Include standard headers
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
// Include GLEW. Always include it before gl.h and glfw.h, since it's a bit magic.
#include <GL/glew.h>
// Include GLFW
#include <GLFW\glfw3.h>
struct nglWindowMouseCoords {
double x;
double y;
};
enum NGL_WINDOW_INPUT_TYPE {
NGL_WINDOW_INPUT_TYPE_MOUSE,
NGL_WINDOW_INPUT_TYPE_KEYBOARD
};
class nglWindow {
public:
static void __stdcall OnKeyPress(GLFWwindow * window, int key, int scancode, int action, int mods);
nglWindow(int width, int height, const char* title);
~nglWindow();
double GetCounterTime();
bool IsKeyDown(int key);
bool IsMouseKeyDown(int key);
void SwapBuffers();
void HookInputs();
void PollEvents();
nglWindowMouseCoords GetCurserPos();
void SetMouseToCenter();
//void SetCallbackMouse(void* func_ptr);
//call this once in every render iteration.
//used for fps
void FrameTick();
int GetFPS();
void ToggleVSync(bool vsync);
void SetWindowTitle(std::string& title);
int GetWindowHeight();
int GetWindowWidth();
private:
GLFWwindow* _window;
int _windowWidth;
int _windowHeigth;
double _lastFrameTime;
//number of frames drawn this second
int _frameCountThisSecond;
//last FPS value
int _lastFPS;
};
#endif // nglWindow_h__