Add support for receiving control characters.
This commit is contained in:
parent
e0c80f5ddd
commit
a52ddc14bb
|
|
@ -70,6 +70,8 @@
|
||||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||||
// Enabling this flag allows manual control of the frame processes, use at your own risk
|
// Enabling this flag allows manual control of the frame processes, use at your own risk
|
||||||
//#define SUPPORT_CUSTOM_FRAME_CONTROL 1
|
//#define SUPPORT_CUSTOM_FRAME_CONTROL 1
|
||||||
|
// Support receiving input of control characters, mainly for backspace and newline characters
|
||||||
|
//#define SUPPORT_INPUT_CONTROL_CHARS 1
|
||||||
|
|
||||||
// rcore: Configuration values
|
// rcore: Configuration values
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
2
src/external/glfw/src/input.c
vendored
2
src/external/glfw/src/input.c
vendored
|
|
@ -314,7 +314,7 @@ void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool
|
||||||
assert(mods == (mods & GLFW_MOD_MASK));
|
assert(mods == (mods & GLFW_MOD_MASK));
|
||||||
assert(plain == GLFW_TRUE || plain == GLFW_FALSE);
|
assert(plain == GLFW_TRUE || plain == GLFW_FALSE);
|
||||||
|
|
||||||
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
if (codepoint > 126 && codepoint < 160) // original: if (codepoint < 32 || (codepoint > 126 && codepoint < 160)) // @nthung-2k5
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!window->lockKeyMods)
|
if (!window->lockKeyMods)
|
||||||
|
|
|
||||||
|
|
@ -5553,6 +5553,10 @@ static void CharCallback(GLFWwindow *window, unsigned int key)
|
||||||
// Ref: https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
// Ref: https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
||||||
// Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
// Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
||||||
|
|
||||||
|
#if !defined(SUPPORT_INPUT_CONTROL_CHARS)
|
||||||
|
// Control characters
|
||||||
|
if (key < 32) return;
|
||||||
|
#endif
|
||||||
// Check if there is space available in the queue
|
// Check if there is space available in the queue
|
||||||
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user