Clearing of input state only occurs locally.
This commit is contained in:
Родитель
8d8eb0c4d5
Коммит
40193213e5
|
@ -294,7 +294,6 @@ void _glfwSetError(int error);
|
|||
void _glfwClearWindowHints(void);
|
||||
|
||||
// Input handling (window.c)
|
||||
void _glfwClearInput(_GLFWwindow* window);
|
||||
void _glfwInputDeactivation(_GLFWwindow* window);
|
||||
void _glfwInputKey(_GLFWwindow* window, int key, int action);
|
||||
void _glfwInputChar(_GLFWwindow* window, int character);
|
||||
|
|
67
src/window.c
67
src/window.c
|
@ -70,6 +70,38 @@ static void closeFlaggedWindows(void)
|
|||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Clear all input state
|
||||
//========================================================================
|
||||
|
||||
void clearInputState(_GLFWwindow* window)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Release all keyboard keys
|
||||
for (i = 0; i <= GLFW_KEY_LAST; i++)
|
||||
window->key[i] = GLFW_RELEASE;
|
||||
|
||||
// Release all mouse buttons
|
||||
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
|
||||
window->mouseButton[i] = GLFW_RELEASE;
|
||||
|
||||
// Set mouse position to (0,0)
|
||||
window->mousePosX = 0;
|
||||
window->mousePosY = 0;
|
||||
|
||||
// Set mouse wheel position to 0
|
||||
window->wheelPos = 0;
|
||||
|
||||
// The default is to use non sticky keys and mouse buttons
|
||||
window->stickyKeys = GL_FALSE;
|
||||
window->stickyMouseButtons = GL_FALSE;
|
||||
|
||||
// The default is to disable key repeat
|
||||
window->keyRepeat = GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -109,38 +141,6 @@ void _glfwInputDeactivation(_GLFWwindow* window)
|
|||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Clear all input state
|
||||
//========================================================================
|
||||
|
||||
void _glfwClearInput(_GLFWwindow* window)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Release all keyboard keys
|
||||
for (i = 0; i <= GLFW_KEY_LAST; i++)
|
||||
window->key[i] = GLFW_RELEASE;
|
||||
|
||||
// Release all mouse buttons
|
||||
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
|
||||
window->mouseButton[i] = GLFW_RELEASE;
|
||||
|
||||
// Set mouse position to (0,0)
|
||||
window->mousePosX = 0;
|
||||
window->mousePosY = 0;
|
||||
|
||||
// Set mouse wheel position to 0
|
||||
window->wheelPos = 0;
|
||||
|
||||
// The default is to use non sticky keys and mouse buttons
|
||||
window->stickyKeys = GL_FALSE;
|
||||
window->stickyMouseButtons = GL_FALSE;
|
||||
|
||||
// The default is to disable key repeat
|
||||
window->keyRepeat = GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Register keyboard activity
|
||||
//========================================================================
|
||||
|
@ -495,8 +495,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
// Clear GLFW window state
|
||||
_glfwClearInput(window);
|
||||
clearInputState(window);
|
||||
|
||||
// Check width & height
|
||||
if (width > 0 && height <= 0)
|
||||
|
|
Загрузка…
Ссылка в новой задаче