]> git.lizzy.rs Git - dragonblocks3d.git/blob - src/dragonblocks/window.hpp
949f5f4af10d6cd26b4919ec8e37f5b023822dc5
[dragonblocks3d.git] / src / dragonblocks / window.hpp
1 #pragma once
2
3 #include <string>
4 #include "gl.hpp"
5
6 namespace dragonblocks
7 {
8         class RenderEngine;
9         
10         class Window
11         {
12                 public:
13                 static Window *create(RenderEngine *);
14                 static void windowPosCallback(GLFWwindow *, int, int);
15                 static void framebufferSizeCallback(GLFWwindow *, int, int);
16                 static void cursorPosCallback(GLFWwindow *, double, double);
17
18                 void setTitle(const std::string &);
19                 void setPos(int, int);
20                 void setSize(int, int);
21                 void toggleFullscreen();
22                 void close();
23                 void swapBuffers();
24                 bool shouldClose() const;
25                 bool wasKeyDown(int) const;
26                 glm::ivec2 getSize() const;
27                 glm::ivec2 getCursorPos() const;
28                 glm::ivec2 getCursorDelta();
29                 
30                 ~Window();
31
32                 private:
33                 static Window *singleton;
34                 
35                 RenderEngine *render_engine;
36                 GLFWwindow *id;
37                 bool fullscreen;
38                 int width, height;
39                 int nfs_width, nfs_height, nfs_x, nfs_y;
40                 int cursor_x, cursor_y, cursor_delta_x, cursor_delta_y;
41                 
42                 void posInput(int, int);
43                 void sizeInput(int, int);
44                 void cursorInput(int, int);
45                 
46                 Window(RenderEngine *);
47         };
48 }
49