From 3d755d617ab6f2a86c272ffb8ecddc2621269c19 Mon Sep 17 00:00:00 2001 From: Ray San Date: Thu, 2 Nov 2017 20:08:52 +0100 Subject: Some code tweaks... --- examples/text/text_ttf_loading.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/text') diff --git a/examples/text/text_ttf_loading.c b/examples/text/text_ttf_loading.c index c9c2fb27..fedfbfb8 100644 --- a/examples/text/text_ttf_loading.c +++ b/examples/text/text_ttf_loading.c @@ -32,7 +32,7 @@ int main() GenTextureMipmaps(&font.texture); float fontSize = font.baseSize; - Vector2 fontPosition = { 40, screenHeight/2 + 50 }; + Vector2 fontPosition = { 40, screenHeight/2 - 50 }; Vector2 textSize; SetTextureFilter(font.texture, FILTER_POINT); -- cgit v1.2.3 From e69424c86fb2e754ebf5dcb95c9bdb2ebd4f0dbc Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 31 Dec 2017 23:50:22 +0100 Subject: Reviewed text input --- examples/text/text_input_box.c | 2 +- src/core.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'examples/text') diff --git a/examples/text/text_input_box.c b/examples/text/text_input_box.c index 54eebf40..5f8d1c01 100644 --- a/examples/text/text_input_box.c +++ b/examples/text/text_input_box.c @@ -52,7 +52,7 @@ int main() letterCount++; } - if (key == KEY_BACKSPACE) + if (IsKeyPressed(KEY_BACKSPACE)) { letterCount--; name[letterCount] = '\0'; diff --git a/src/core.c b/src/core.c index 7d7e188c..60bc58b8 100644 --- a/src/core.c +++ b/src/core.c @@ -2432,7 +2432,9 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i else { 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 } -// 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) -{ +{ + // 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 + lastKeyPressed = key; - - //TraceLog(LOG_INFO, "Char Callback Key pressed: %i\n", key); } // GLFW3 CursorEnter Callback, when cursor enters the window -- cgit v1.2.3