1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

Fixed plural forms on key/button arrays.

This commit is contained in:
Camilla Berglund 2014-05-18 21:28:11 +02:00
parent cdd44849b8
commit 7cb217ed4a
4 changed files with 22 additions and 22 deletions

View File

@ -93,8 +93,8 @@ static void setStickyKeys(_GLFWwindow* window, int enabled)
// Release all sticky keys // Release all sticky keys
for (i = 0; i <= GLFW_KEY_LAST; i++) for (i = 0; i <= GLFW_KEY_LAST; i++)
{ {
if (window->key[i] == _GLFW_STICK) if (window->keys[i] == _GLFW_STICK)
window->key[i] = GLFW_RELEASE; window->keys[i] = GLFW_RELEASE;
} }
} }
@ -115,8 +115,8 @@ static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
// Release all sticky mouse buttons // Release all sticky mouse buttons
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
{ {
if (window->mouseButton[i] == _GLFW_STICK) if (window->mouseButtons[i] == _GLFW_STICK)
window->mouseButton[i] = GLFW_RELEASE; window->mouseButtons[i] = GLFW_RELEASE;
} }
} }
@ -134,16 +134,16 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
{ {
GLboolean repeated = GL_FALSE; GLboolean repeated = GL_FALSE;
if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE) if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE)
return; return;
if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS) if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS)
repeated = GL_TRUE; repeated = GL_TRUE;
if (action == GLFW_RELEASE && window->stickyKeys) if (action == GLFW_RELEASE && window->stickyKeys)
window->key[key] = _GLFW_STICK; window->keys[key] = _GLFW_STICK;
else else
window->key[key] = (char) action; window->keys[key] = (char) action;
if (repeated) if (repeated)
action = GLFW_REPEAT; action = GLFW_REPEAT;
@ -175,9 +175,9 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
// Register mouse button action // Register mouse button action
if (action == GLFW_RELEASE && window->stickyMouseButtons) if (action == GLFW_RELEASE && window->stickyMouseButtons)
window->mouseButton[button] = _GLFW_STICK; window->mouseButtons[button] = _GLFW_STICK;
else else
window->mouseButton[button] = (char) action; window->mouseButtons[button] = (char) action;
if (window->callbacks.mouseButton) if (window->callbacks.mouseButton)
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods); window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);
@ -282,14 +282,14 @@ GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
return GLFW_RELEASE; return GLFW_RELEASE;
} }
if (window->key[key] == _GLFW_STICK) if (window->keys[key] == _GLFW_STICK)
{ {
// Sticky mode: release key now // Sticky mode: release key now
window->key[key] = GLFW_RELEASE; window->keys[key] = GLFW_RELEASE;
return GLFW_PRESS; return GLFW_PRESS;
} }
return (int) window->key[key]; return (int) window->keys[key];
} }
GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button) GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
@ -305,14 +305,14 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
return GLFW_RELEASE; return GLFW_RELEASE;
} }
if (window->mouseButton[button] == _GLFW_STICK) if (window->mouseButtons[button] == _GLFW_STICK)
{ {
// Sticky mode: release mouse button now // Sticky mode: release mouse button now
window->mouseButton[button] = GLFW_RELEASE; window->mouseButtons[button] = GLFW_RELEASE;
return GLFW_PRESS; return GLFW_PRESS;
} }
return (int) window->mouseButton[button]; return (int) window->mouseButtons[button];
} }
GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos) GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)

View File

@ -232,8 +232,8 @@ struct _GLFWwindow
GLboolean stickyMouseButtons; GLboolean stickyMouseButtons;
double cursorPosX, cursorPosY; double cursorPosX, cursorPosY;
int cursorMode; int cursorMode;
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1]; char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
char key[GLFW_KEY_LAST + 1]; char keys[GLFW_KEY_LAST + 1];
// OpenGL extensions and context attributes // OpenGL extensions and context attributes
struct { struct {

View File

@ -1218,10 +1218,10 @@ void _glfwPlatformPollEvents(void)
// See if this differs from our belief of what has happened // See if this differs from our belief of what has happened
// (we only have to check for lost key up events) // (we only have to check for lost key up events)
if (!lshiftDown && window->key[GLFW_KEY_LEFT_SHIFT] == 1) if (!lshiftDown && window->keys[GLFW_KEY_LEFT_SHIFT] == 1)
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, 0, GLFW_RELEASE, mods); _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, 0, GLFW_RELEASE, mods);
if (!rshiftDown && window->key[GLFW_KEY_RIGHT_SHIFT] == 1) if (!rshiftDown && window->keys[GLFW_KEY_RIGHT_SHIFT] == 1)
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, 0, GLFW_RELEASE, mods); _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, 0, GLFW_RELEASE, mods);
} }

View File

@ -57,14 +57,14 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
// Release all pressed keyboard keys // Release all pressed keyboard keys
for (i = 0; i <= GLFW_KEY_LAST; i++) for (i = 0; i <= GLFW_KEY_LAST; i++)
{ {
if (window->key[i] == GLFW_PRESS) if (window->keys[i] == GLFW_PRESS)
_glfwInputKey(window, i, 0, GLFW_RELEASE, 0); _glfwInputKey(window, i, 0, GLFW_RELEASE, 0);
} }
// Release all pressed mouse buttons // Release all pressed mouse buttons
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
{ {
if (window->mouseButton[i] == GLFW_PRESS) if (window->mouseButtons[i] == GLFW_PRESS)
_glfwInputMouseClick(window, i, GLFW_RELEASE, 0); _glfwInputMouseClick(window, i, GLFW_RELEASE, 0);
} }
} }