Window.h 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef WINDOW_H
  2. #define WINDOW_H
  3. #include <GL/glew.h>
  4. #include <GLFW/glfw3.h>
  5. #include "input/TextInput.h"
  6. #include "rendering/WindowOptions.h"
  7. class Window final {
  8. TextInput& textInput;
  9. GLFWwindow* window;
  10. public:
  11. Window(TextInput& textInput, const WindowOptions& options);
  12. ~Window();
  13. Window(const Window&) = delete;
  14. Window& operator=(const Window&) = delete;
  15. Window(Window&&) = delete;
  16. Window& operator=(Window&&) = delete;
  17. bool hasError() const;
  18. void show();
  19. bool shouldClose() const;
  20. void swapBuffers();
  21. void trapCursor(bool trap);
  22. Size getSize() const;
  23. Size getFramebufferSize() const;
  24. bool isKeyDown(int key) const;
  25. bool isMouseDown(int mouse) const;
  26. void getMousePosition(double& x, double& y) const;
  27. private:
  28. static void keyCallback(GLFWwindow* w, int key, int scancode, int action,
  29. int mods);
  30. static void charCallback(GLFWwindow* w, unsigned int codepoint);
  31. };
  32. #endif