Documentation work.

This commit is contained in:
Camilla Berglund
2014-10-07 23:37:59 +02:00
parent 3afa831e28
commit 496567d3f1
6 changed files with 73 additions and 65 deletions
+20 -6
View File
@@ -146,16 +146,30 @@ The `GLFW_KEY_LAST` constant holds the highest value of any
[named key](@ref keys).
@subsection input_char Unicode character input
@subsection input_char Text input
If you wish to receive Unicode code point input, set a character callback.
GLFW supports text input in the form of a stream of
[Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the
operating system text input system. Unlike key input, text input obeys keyboard
layouts and modifier keys and supports composing characters using
[dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can
encode the code points into
[UTF-8](https://en.wikipedia.org/wiki/UTF-8) or any other encoding you prefer.
Because an `unsigned int` is 32 bits long on all platforms supported by GLFW,
you can treat the code point argument as native endian
[UTF-32](https://en.wikipedia.org/wiki/UTF-32).
There are two callbacks for receiving Unicode code points. If you wish to
offer regular text input, set a character callback.
@code
glfwSetCharCallback(window, character_callback);
@endcode
The callback function receives Unicode code points for key events that would
have led to regular text input on that platform.
have led to regular text input and generally behaves as a standard text field on
that platform.
@code
void character_callback(GLFWwindow* window, unsigned int codepoint)
@@ -163,9 +177,9 @@ void character_callback(GLFWwindow* window, unsigned int codepoint)
}
@endcode
If you wish to receive all Unicode code point events generated by the system, or
just want to know exactly what modifier keys were used, set a character with
modifiers callback.
If you wish to receive even those Unicode code points generated with modifier
key combinations that a plain text field would ignore, or just want to know
exactly what modifier keys were used, set a character with modifiers callback.
@code
glfwSetCharCallback(window, charmods_callback);