Unified nomenclature for cursor positions.

This commit is contained in:
Camilla Berglund
2012-06-22 13:53:02 +02:00
parent e6896a499c
commit cef9dea1d2
14 changed files with 102 additions and 101 deletions

View File

@@ -50,7 +50,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
gluOrtho2D(0.f, window_width, 0.f, window_height);
}
static void mouse_position_callback(GLFWwindow window, int x, int y)
static void cursor_position_callback(GLFWwindow window, int x, int y)
{
cursor_x = x;
cursor_y = y;
@@ -75,7 +75,7 @@ int main(void)
exit(EXIT_FAILURE);
}
glfwSetMousePosCallback(mouse_position_callback);
glfwSetCursorPosCallback(cursor_position_callback);
glfwSetWindowSizeCallback(window_size_callback);
glfwSwapInterval(1);

View File

@@ -270,9 +270,9 @@ static void mouse_button_callback(GLFWwindow window, int button, int action)
printf(" was %s\n", get_action_name(action));
}
static void mouse_position_callback(GLFWwindow window, int x, int y)
static void cursor_position_callback(GLFWwindow window, int x, int y)
{
printf("%08x at %0.3f: Mouse position: %i %i\n", counter++, glfwGetTime(), x, y);
printf("%08x at %0.3f: Cursor position: %i %i\n", counter++, glfwGetTime(), x, y);
}
static void cursor_enter_callback(GLFWwindow window, int entered)
@@ -361,7 +361,7 @@ int main(void)
glfwSetWindowFocusCallback(window_focus_callback);
glfwSetWindowIconifyCallback(window_iconify_callback);
glfwSetMouseButtonCallback(mouse_button_callback);
glfwSetMousePosCallback(mouse_position_callback);
glfwSetCursorPosCallback(cursor_position_callback);
glfwSetCursorEnterCallback(cursor_enter_callback);
glfwSetScrollCallback(scroll_callback);
glfwSetKeyCallback(key_callback);

View File

@@ -1,5 +1,5 @@
//========================================================================
// Mouse cursor bug test
// Cursor input bug test
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
@@ -41,7 +41,7 @@ static int cursor_y;
static GLboolean open_window(void);
static void toggle_mouse_cursor(GLFWwindow window)
static void toggle_cursor(GLFWwindow window)
{
if (glfwGetInputMode(window, GLFW_CURSOR_MODE) == GLFW_CURSOR_CAPTURED)
{
@@ -55,9 +55,9 @@ static void toggle_mouse_cursor(GLFWwindow window)
}
}
static void mouse_position_callback(GLFWwindow window, int x, int y)
static void cursor_position_callback(GLFWwindow window, int x, int y)
{
printf("Mouse moved to: %i %i (%i %i)\n", x, y, x - cursor_x, y - cursor_y);
printf("Cursor moved to: %i %i (%i %i)\n", x, y, x - cursor_x, y - cursor_y);
cursor_x = x;
cursor_y = y;
}
@@ -69,7 +69,7 @@ static void key_callback(GLFWwindow window, int key, int action)
case GLFW_KEY_SPACE:
{
if (action == GLFW_PRESS)
toggle_mouse_cursor(window);
toggle_cursor(window);
break;
}
@@ -98,11 +98,11 @@ static GLboolean open_window(void)
if (!window_handle)
return GL_FALSE;
glfwGetMousePos(window_handle, &cursor_x, &cursor_y);
printf("Mouse position: %i %i\n", cursor_x, cursor_y);
glfwGetCursorPos(window_handle, &cursor_x, &cursor_y);
printf("Cursor position: %i %i\n", cursor_x, cursor_y);
glfwSetWindowSizeCallback(window_size_callback);
glfwSetMousePosCallback(mouse_position_callback);
glfwSetCursorPosCallback(cursor_position_callback);
glfwSetKeyCallback(key_callback);
glfwSwapInterval(1);