Reviewed text input
This commit is contained in:
parent
e7cf03b1e4
commit
e69424c86f
2 changed files with 11 additions and 6 deletions
|
@ -52,7 +52,7 @@ int main()
|
||||||
letterCount++;
|
letterCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == KEY_BACKSPACE)
|
if (IsKeyPressed(KEY_BACKSPACE))
|
||||||
{
|
{
|
||||||
letterCount--;
|
letterCount--;
|
||||||
name[letterCount] = '\0';
|
name[letterCount] = '\0';
|
||||||
|
|
13
src/core.c
13
src/core.c
|
@ -2432,7 +2432,9 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentKeyState[key] = action;
|
currentKeyState[key] = action;
|
||||||
if (action == GLFW_PRESS) lastKeyPressed = key;
|
|
||||||
|
// NOTE: lastKeyPressed already registered on CharCallback()
|
||||||
|
//if (action == GLFW_PRESS) lastKeyPressed = key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2498,12 +2500,15 @@ static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3 Char Key Callback, runs on key pressed (get char value)
|
// GLFW3 Char Key Callback, runs on key down (get unicode char value)
|
||||||
static void CharCallback(GLFWwindow *window, unsigned int key)
|
static void CharCallback(GLFWwindow *window, unsigned int key)
|
||||||
{
|
{
|
||||||
lastKeyPressed = key;
|
// NOTE: Registers any key down considering OS keyboard layout but
|
||||||
|
// do not detects action events, those should be managed by user...
|
||||||
|
// https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
||||||
|
// http://www.glfw.org/docs/latest/input_guide.html#input_char
|
||||||
|
|
||||||
//TraceLog(LOG_INFO, "Char Callback Key pressed: %i\n", key);
|
lastKeyPressed = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3 CursorEnter Callback, when cursor enters the window
|
// GLFW3 CursorEnter Callback, when cursor enters the window
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue