]> git.lizzy.rs Git - dragonblocks3d.git/blob - src/dragonblocks/window.hpp
Multithreading
[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                 void makeContextCurrent() const;
27                 glm::ivec2 getSize() const;
28                 glm::ivec2 getCursorPos() const;
29                 glm::ivec2 getCursorDelta();
30                 
31                 ~Window();
32
33                 private:
34                 static Window *singleton;
35                 
36                 RenderEngine *render_engine;
37                 GLFWwindow *id;
38                 bool fullscreen;
39                 int width, height;
40                 int nfs_width, nfs_height, nfs_x, nfs_y;
41                 int cursor_x, cursor_y, cursor_delta_x, cursor_delta_y;
42                 
43                 void posInput(int, int);
44                 void sizeInput(int, int);
45                 void cursorInput(int, int);
46                 
47                 Window(RenderEngine *);
48         };
49 }
50