SimpleGL  1.1.0
A framework for platform independent rendering
glfw_callback.hpp
Go to the documentation of this file.
1 
8 #ifndef GLFW_CALLBACK_HPP
9 #define GLFW_CALLBACK_HPP
10 
11 #include "SimpleGL_Export.h"
12 
13 #include <string>
14 
15 #include <GLFW/glfw3.h>
16 
17 #include "input.hpp"
18 
19 namespace sgl {
20 
26  class SIMPLEGL_EXPORT ErrorCallback {
27 
28  protected:
31 
32  public:
38  static ErrorCallback* getCurrent();
39 
45  static void setCurrent(ErrorCallback* callback);
46 
53  static void dispatch(int error, const char* description);
54 
56  ErrorCallback(void);
57 
59  ~ErrorCallback(void);
60 
67  virtual void invoke(int error, std::string description);
68  };
69 
75  class SIMPLEGL_EXPORT KeyCallback {
76 
77  protected:
80 
81  public:
87  static KeyCallback* getCurrent();
88 
94  static void setCurrent(KeyCallback* callback);
95 
105  static void dispatch(GLFWwindow* window, int key, int scancode, int action, int mods);
106 
108  KeyCallback(void);
109 
111  ~KeyCallback(void);
112 
122  virtual void invoke(GLFWwindow* window, Key key, int scancode, Action action, Modifier mods);
123  };
124 
130  class SIMPLEGL_EXPORT MouseButtonCallback {
131 
132  protected:
135 
136  public:
142  static MouseButtonCallback* getCurrent();
143 
149  static void setCurrent(MouseButtonCallback* callback);
150 
159  static void dispatch(GLFWwindow* window, int button, int action, int mods);
160 
162  MouseButtonCallback(void);
163 
165  ~MouseButtonCallback(void);
166 
175  virtual void invoke(GLFWwindow* window, MouseButton button, Action action, Modifier mods);
176  };
177 }
178 
179 #endif /* GLFW_CALLBACK_HPP */
MouseButton
This enum wraps the GLFW mouse buttons.
Definition: input.hpp:396
Key
This enum wraps the GLFW keys.
Definition: input.hpp:22
This class wraps a GLFW error callback.
Modifier
This enum wraps the GLFW modifier bits.
Definition: input.hpp:457
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
This class wraps a GLFW mouse button callback.
This class wraps a GLFW key callback.
Action
This enum wraps the GLFW actions.
Definition: input.hpp:440
static KeyCallback * current
Stores the current instance of the key callback.
static ErrorCallback * current
Stores the current instance of the error callback.
static MouseButtonCallback * current
Stores the current instance of the mouse button callback.