MOS
window.hpp
1 #pragma once
2 
3 #include <glad/glad.h>
4 #include <GLFW/glfw3.h>
5 #include <glm/glm.hpp>
6 #include <mos/io/gamepad.hpp>
7 #include <mos/io/keyboard.hpp>
8 #include <mos/io/mouse.hpp>
9 #include <string>
10 
11 namespace mos::io {
12 
13 class [[deprecated("Use glfw or similar directly")]] Window {
14 public:
15  struct Output {
16  Keyboard keyboard;
17  Mouse mouse;
18  Gamepad gamepad;
19  };
20  Window(const std::string &title = "Window",
21  const glm::ivec2 &resolution = {1920, 1080},
22  int swap_interval = 0);
23  ~Window();
24  static Output poll_events();
25  void swap_buffers();
26  float dpi() const;
27  bool close() const;
28  void close(const bool close);
29 private:
30  GLFWwindow *window_;
31  static Keyboard keyboard_;
32  static Mouse mouse_;
33  static Gamepad gamepad_;
34  static void error_callback(int error, const char* description);
35  static void key_callback(GLFWwindow * window, int key, int scancode, int action, int mods);
36  static void char_callback(GLFWwindow * window, const unsigned int codepoint);
37  static void cursor_position_callback(GLFWwindow * window, double xpos, double ypos);
38  static void mouse_button_callback(GLFWwindow * window, int button, int action, int mods);
39 };
40 }
Definition: gamepad.hpp:5