33 glfwWindowHint(GLFW_SAMPLES, 4);
34 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
35 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
36 glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
37 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
40 fullscreen ? glfwGetPrimaryMonitor() :
nullptr,
nullptr);
46 glfwMakeContextCurrent(
window);
55 glfwGetWindowSize(
window, &w, &h);
65 if (glfwWindowShouldClose(
window)) {
85 assert((s.x > 0) && (s.y > 0));
87 if ((
size.x != s.x) || (
size.y != s.y)) {
88 glfwSetWindowSize(
window, s.x, s.y);
104 glfwSetInputMode(
window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
106 glfwSetInputMode(
window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
116 glfwSetClipboardString(
window, s);
121 return glfwGetClipboardString(
window);
135 size = glm::i32vec2(width, height);
148 if (((mods & GLFW_MOD_SHIFT) != 0) !=
modShift) {
149 modShift = (mods & GLFW_MOD_SHIFT) != 0;
153 if (((mods & GLFW_MOD_CONTROL) != 0) !=
modControl) {
158 if (((mods & GLFW_MOD_ALT) != 0) !=
modAlt) {
159 modAlt = (mods & GLFW_MOD_ALT) != 0;
163 if (((mods & GLFW_MOD_SUPER) != 0) !=
modSuper) {
164 modSuper = (mods & GLFW_MOD_SUPER) != 0;
168 if (
textinput && (action != GLFW_RELEASE)) {
170 if ((key >=
'0') && (key <=
'9')) {
171 char s[2] = { (char)key,
'\0' };
173 }
else if ((key >=
'A') && (key <=
'Z')) {
174 key = key -
'A' +
'a';
175 char s[2] = { (char)key,
'\0' };
177 key = key -
'a' +
'A';
186 if (((mods & GLFW_MOD_SHIFT) != 0) !=
modShift) {
187 modShift = (mods & GLFW_MOD_SHIFT) != 0;
191 if (((mods & GLFW_MOD_CONTROL) != 0) !=
modControl) {
196 if (((mods & GLFW_MOD_ALT) != 0) !=
modAlt) {
197 modAlt = (mods & GLFW_MOD_ALT) != 0;
201 if (((mods & GLFW_MOD_SUPER) != 0) !=
modSuper) {
202 modSuper = (mods & GLFW_MOD_SUPER) != 0;
208 case GLFW_MOUSE_BUTTON_LEFT:
212 case GLFW_MOUSE_BUTTON_RIGHT:
216 case GLFW_MOUSE_BUTTON_MIDDLE:
234 if ((key >=
'0') && (key <=
'9')) {
236 }
else if ((key >=
'A') && (key <=
'Z')) {
237 key = key -
'A' +
'a';
323 case GLFW_KEY_BACKSPACE:
329 case GLFW_KEY_ESCAPE:
380 case GLFW_KEY_PAGE_UP:
383 case GLFW_KEY_PAGE_DOWN:
392 case GLFW_KEY_INSERT:
static void swapBuffers()
static GLFWwindow * window
static void setFullscreen(bool f)
static void handleMouseScroll(int xrel, int yrel)
static void eventHandling()
GLFW Windowing Implementation.
static void cursorCallback(GLFWwindow *w, double xpos, double ypos)
static void setClipboard(const char *s)
static LogLevel & get(int level)
static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs)
static void setMousegrab(bool g)
static void scrollCallback(GLFWwindow *w, double xoffset, double yoffset)
static void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released)
static void error(char *msg)
static KeyboardButton convertAsciiButton(int key)
static void setRunning(bool run)
static void buttonCallback(GLFWwindow *w, int button, int action, int mods)
static void errorCallback(int error, const char *desc)
Runtime Configuration Storage.
static const char * getClipboard()
static void handleKeyboard(KeyboardButton key, bool pressed)
static void sizeCallback(GLFWwindow *w, int width, int height)
static void setTextInput(bool t)
static void eventsFinished()
static void handleText(char *text, bool notFinished)
static void setSize(glm::i32vec2 s)
static void inputPositionCallback(int x, int y)
static void keyCallback(GLFWwindow *w, int key, int scancode, int action, int mods)
static void setSize(glm::i32vec2 s)