1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Merge branch 'master' of github.com:elmindreda/glfw

This commit is contained in:
Camilla Berglund 2012-02-14 23:14:44 +01:00
commit e23eed7e27
3 changed files with 3 additions and 9 deletions

View File

@ -351,10 +351,8 @@ GLFWAPI int glfwGetKey(GLFWwindow handle, int key)
return GLFW_RELEASE; return GLFW_RELEASE;
} }
// Is it a valid key?
if (key < 0 || key > GLFW_KEY_LAST) if (key < 0 || key > GLFW_KEY_LAST)
{ {
// TODO: Decide whether key is a value or enum
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM,
"glfwGetKey: The specified key is invalid"); "glfwGetKey: The specified key is invalid");
return GLFW_RELEASE; return GLFW_RELEASE;
@ -385,7 +383,6 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow handle, int button)
return GLFW_RELEASE; return GLFW_RELEASE;
} }
// Is it a valid mouse button?
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST) if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM,
@ -418,7 +415,6 @@ GLFWAPI void glfwGetMousePos(GLFWwindow handle, int* xpos, int* ypos)
return; return;
} }
// Return mouse position
if (xpos != NULL) if (xpos != NULL)
*xpos = window->cursorPosX; *xpos = window->cursorPosX;
@ -547,7 +543,6 @@ GLFWAPI void glfwSetMousePosCallback(GLFWmouseposfun cbfun)
return; return;
} }
// Set callback function
_glfwLibrary.mousePosCallback = cbfun; _glfwLibrary.mousePosCallback = cbfun;
// Call the callback function to let the application know the current // Call the callback function to let the application know the current
@ -574,7 +569,6 @@ GLFWAPI void glfwSetScrollCallback(GLFWscrollfun cbfun)
return; return;
} }
// Set callback function
_glfwLibrary.scrollCallback = cbfun; _glfwLibrary.scrollCallback = cbfun;
} }

View File

@ -655,7 +655,6 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
if (!window->iconified) if (!window->iconified)
return; return;
// Restore iconified window
_glfwPlatformRestoreWindow(window); _glfwPlatformRestoreWindow(window);
if (window->mode == GLFW_FULLSCREEN) if (window->mode == GLFW_FULLSCREEN)

View File

@ -69,7 +69,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Tearing Detector", NULL); window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();
@ -78,9 +78,10 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
set_swap_interval(1);
glfwSetWindowSizeCallback(window_size_callback); glfwSetWindowSizeCallback(window_size_callback);
glfwSetKeyCallback(key_callback); glfwSetKeyCallback(key_callback);
set_swap_interval(1);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f); glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f);