static void cursor_position_callback(GLFWwindow* window, double x, double y) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Cursor position: %f %f\n", counter++, slot->number, glfwGetTime(), x, y); }
static void window_pos_callback(GLFWwindow* window, int x, int y) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window position: %i %i\n", counter++, slot->number, glfwGetTime(), x, y); }
static void window_size_callback(GLFWwindow* window, int width, int height) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Window size: %i %i\n", counter++, slot->number, glfwGetTime(), width, height); }
void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods) { Window* win = (Window*)glfwGetWindowUserPointer(window); win->m_Keys[key] = (action != GLFW_RELEASE); }
static void GLFWdropfunProc(GLFWwindow* window, int count, const char** names) { jobject callback = (jobject)glfwGetWindowUserPointer(window); JNIEnv* env = getEnv(); (*env)->CallVoidMethod(env, callback, GLFWdropfunInvoke, (jlong)(intptr_t)window, (jint)count, (jlong)(intptr_t)names); }
void BaseApplication::_OnMousebuttonfun(GLFWwindow* window, int button, int action, int mods) { BaseApplication* app = static_cast<BaseApplication*>(glfwGetWindowUserPointer(window)); app->onMousebutton(button, action); }
void BaseApplication::_OnKeyfun(GLFWwindow* window, int key, int scancode, int action, int mods) { BaseApplication* app = static_cast<BaseApplication*>(glfwGetWindowUserPointer(window)); app->onKey(key, action); }
void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, int mods) { GLFWView *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); if (action == GLFW_RELEASE) { switch (key) { case GLFW_KEY_ESCAPE: glfwSetWindowShouldClose(window, true); break; case GLFW_KEY_TAB: view->map->cycleDebugOptions(); break; case GLFW_KEY_X: if (!mods) view->map->resetPosition(); break; case GLFW_KEY_S: if (view->changeStyleCallback) view->changeStyleCallback(); break; case GLFW_KEY_R: if (!mods) { view->map->setDefaultTransitionDuration(std::chrono::milliseconds(300)); if (view->map->hasClass("night")) { view->map->removeClass("night"); } else { view->map->addClass("night"); } } break; case GLFW_KEY_N: if (!mods) view->map->resetNorth(); break; case GLFW_KEY_Z: view->nextOrientation(); break; case GLFW_KEY_Q: view->clearAnnotations(); break; case GLFW_KEY_P: { view->addRandomCustomPointAnnotations(1); } break; } } if (action == GLFW_RELEASE || action == GLFW_REPEAT) { switch (key) { case GLFW_KEY_W: view->popAnnotation(); break; case GLFW_KEY_1: view->addRandomPointAnnotations(1); break; case GLFW_KEY_2: view->addRandomPointAnnotations(10); break; case GLFW_KEY_3: view->addRandomPointAnnotations(100); break; case GLFW_KEY_4: view->addRandomPointAnnotations(1000); break; case GLFW_KEY_5: view->addRandomPointAnnotations(10000); break; case GLFW_KEY_6: view->addRandomPointAnnotations(100000); break; case GLFW_KEY_7: view->addRandomShapeAnnotations(1); break; case GLFW_KEY_8: view->addRandomShapeAnnotations(10); break; case GLFW_KEY_9: view->addRandomShapeAnnotations(100); break; case GLFW_KEY_0: view->addRandomShapeAnnotations(1000); break; } } }
void cursor_position_callback(GLFWwindow* window, double xpos, double ypos) { Window* win = (Window*)glfwGetWindowUserPointer(window); win->mx = xpos; win->my = ypos; }
static void GLFWcharmodsfunProc(GLFWwindow* window, unsigned int codepoint, int mods) { jobject callback = (jobject)glfwGetWindowUserPointer(window); JNIEnv* env = getEnv(); (*env)->CallVoidMethod(env, callback, GLFWcharmodsfunInvoke, (jlong)(intptr_t)window, (jint)codepoint, (jint)mods); }
static void GLFWmousebuttonfunProc(GLFWwindow* window, int button, int action, int mods) { jobject callback = (jobject)glfwGetWindowUserPointer(window); JNIEnv* env = getEnv(); (*env)->CallVoidMethod(env, callback, GLFWmousebuttonfunInvoke, (jlong)(intptr_t)window, (jint)button, (jint)action, (jint)mods); }
static void GLFWframebuffersizefunProc(GLFWwindow* window, int width, int height) { jobject callback = (jobject)glfwGetWindowUserPointer(window); JNIEnv* env = getEnv(); (*env)->CallVoidMethod(env, callback, GLFWframebuffersizefunInvoke, (jlong)(intptr_t)window, (jint)width, (jint)height); }
static void GLFWwindowiconifyfunProc(GLFWwindow* window, int iconified) { jobject callback = (jobject)glfwGetWindowUserPointer(window); JNIEnv* env = getEnv(); (*env)->CallVoidMethod(env, callback, GLFWwindowiconifyfunInvoke, (jlong)(intptr_t)window, (jint)iconified); }
static void GLFWwindowposfunProc(GLFWwindow* window, int xpos, int ypos) { jobject callback = (jobject)glfwGetWindowUserPointer(window); JNIEnv* env = getEnv(); (*env)->CallVoidMethod(env, callback, GLFWwindowposfunInvoke, (jlong)(intptr_t)window, (jint)xpos, (jint)ypos); }
static void scroll_callback(GLFWwindow* window, double x, double y) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Scroll: %0.3f %0.3f\n", counter++, slot->number, glfwGetTime(), x, y); }
static void KeyFunc(GLFWwindow* window, int key, int state) { GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window); glwnd->onKeyDown(glfw_to_ukn_key(key), state); }
void BaseApplication::_OnWindowsizefun(GLFWwindow* window, int w, int h) { BaseApplication* app = static_cast<BaseApplication*>(glfwGetWindowUserPointer(window)); app->onWindowSize(w, h); }
static void WindowSizeFunc(GLFWwindow* window, int w, int h) { GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window); WindowResizeEventArgs args(w, h); glwnd->onResize().raise(glwnd, args); }
void BaseApplication::_OnMouseposfun(GLFWwindow* window, double x, double y) { BaseApplication* app = static_cast<BaseApplication*>(glfwGetWindowUserPointer(window)); app->onMousepos(x, y); }
static int WindowCloseFunc(GLFWwindow* window) { GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window); glwnd->onClose().raise(glwnd, _NullEventArgs); return 1; }
void MouseButtonCallback(GLFWwindow* window, int button, int action, int mods) { Window* win = (Window*)glfwGetWindowUserPointer(window); win->m_MouseButtons[button] = (action != GLFW_RELEASE); }
static void WindowIconifyFunc(GLFWwindow* window, int f) { GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window); WindowBoolEventArgs args(f > 0 ? true: false); glwnd->onIconify().raise(glwnd, args); }
void* dtemu_get_ud(void* context) { GLFWwindow* w = context; return glfwGetWindowUserPointer(context); }
static void GLFWscrollfunProc(GLFWwindow* window, double xpos, double ypos) { jobject callback = (jobject)glfwGetWindowUserPointer(window); JNIEnv* env = getEnv(); (*env)->CallVoidMethod(env, callback, GLFWscrollfunInvoke, (jlong)(intptr_t)window, (jdouble)xpos, (jdouble)ypos); }