1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-29 21:48:52 -05:00

Removed glfwGetScrollOffset.

Scroll events do not represent an absolute state, but rather an interpretation
of a relative change in state, like character input.  So, like character input,
there is no sane 'current state' to return.  The here removed solution, that of
accumulating an offset since the last call to event processing, is at best
mildly confusing.  If a user wishes to implement this solution, it is better for
it to be explicit in client code than implicit in GLFW calls.
This commit is contained in:
Camilla Berglund 2013-01-17 19:50:04 +01:00
parent c17a7dd464
commit 2cea6e37cf
4 changed files with 0 additions and 45 deletions

View File

@ -1377,10 +1377,6 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, int* xpos, int* ypos);
*/ */
GLFWAPI void glfwSetCursorPos(GLFWwindow* window, int xpos, int ypos); GLFWAPI void glfwSetCursorPos(GLFWwindow* window, int xpos, int ypos);
/*! @ingroup input
*/
GLFWAPI void glfwGetScrollOffset(GLFWwindow* window, double* xoffset, double* yoffset);
/*! @brief Sets the key callback. /*! @brief Sets the key callback.
* @param[in] window The window whose callback to set. * @param[in] window The window whose callback to set.
* @param[in] cbfun The new key callback, or @c NULL to remove the currently * @param[in] cbfun The new key callback, or @c NULL to remove the currently

View File

@ -160,9 +160,6 @@ void _glfwInputChar(_GLFWwindow* window, int character)
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
{ {
window->scrollX += xoffset;
window->scrollY += yoffset;
if (window->callbacks.scroll) if (window->callbacks.scroll)
window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset); window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
} }
@ -370,23 +367,6 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, int xpos, int ypos)
_glfwPlatformSetCursorPos(window, xpos, ypos); _glfwPlatformSetCursorPos(window, xpos, ypos);
} }
GLFWAPI void glfwGetScrollOffset(GLFWwindow* handle, double* xoffset, double* yoffset)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!_glfwInitialized)
{
_glfwInputError(GLFW_NOT_INITIALIZED, NULL);
return;
}
if (xoffset)
*xoffset = window->scrollX;
if (yoffset)
*yoffset = window->scrollY;
}
GLFWAPI void glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun) GLFWAPI void glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
{ {
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;

View File

@ -221,7 +221,6 @@ struct _GLFWwindow
GLboolean stickyMouseButtons; GLboolean stickyMouseButtons;
int cursorPosX, cursorPosY; int cursorPosX, cursorPosY;
int cursorMode; int cursorMode;
double scrollX, scrollY;
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1]; char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
char key[GLFW_KEY_LAST + 1]; char key[GLFW_KEY_LAST + 1];

View File

@ -48,22 +48,6 @@ static int Max(int a, int b)
} }
//========================================================================
// Clear scroll offsets for all windows
//========================================================================
static void clearScrollOffsets(void)
{
_GLFWwindow* window;
for (window = _glfw.windowListHead; window; window = window->next)
{
window->scrollX = 0;
window->scrollY = 0;
}
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW event API ////// ////// GLFW event API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -746,8 +730,6 @@ GLFWAPI void glfwPollEvents(void)
return; return;
} }
clearScrollOffsets();
_glfwPlatformPollEvents(); _glfwPlatformPollEvents();
} }
@ -759,8 +741,6 @@ GLFWAPI void glfwWaitEvents(void)
return; return;
} }
clearScrollOffsets();
_glfwPlatformWaitEvents(); _glfwPlatformWaitEvents();
} }