mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Clarified character callback parameter.
This commit is contained in:
parent
7dd8770e6f
commit
2c920fbb8b
@ -765,7 +765,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
||||
* This is the function signature for Unicode character callback functions.
|
||||
*
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] character The Unicode code point of the character.
|
||||
* @param[in] codepoint The Unicode code point of the character.
|
||||
*
|
||||
* @sa glfwSetCharCallback
|
||||
*
|
||||
|
@ -148,13 +148,13 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
|
||||
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
|
||||
}
|
||||
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int character)
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint)
|
||||
{
|
||||
if (character < 32 || (character > 126 && character < 160))
|
||||
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
||||
return;
|
||||
|
||||
if (window->callbacks.character)
|
||||
window->callbacks.character((GLFWwindow*) window, character);
|
||||
window->callbacks.character((GLFWwindow*) window, codepoint);
|
||||
}
|
||||
|
||||
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
||||
|
@ -624,10 +624,10 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
|
||||
|
||||
/*! @brief Notifies shared code of a Unicode character input event.
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] character The Unicode code point of the input character.
|
||||
* @param[in] codepoint The Unicode code point of the input character.
|
||||
* @ingroup event
|
||||
*/
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int character);
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint);
|
||||
|
||||
/*! @brief Notifies shared code of a scroll event.
|
||||
* @param[in] window The window that received the event.
|
||||
|
@ -228,12 +228,12 @@ static const char* get_mods_name(int mods)
|
||||
return name;
|
||||
}
|
||||
|
||||
static const char* get_character_string(int character)
|
||||
static const char* get_character_string(int codepoint)
|
||||
{
|
||||
// This assumes UTF-8, which is stupid
|
||||
static char result[6 + 1];
|
||||
|
||||
int length = wctomb(result, character);
|
||||
int length = wctomb(result, codepoint);
|
||||
if (length == -1)
|
||||
length = 0;
|
||||
|
||||
@ -372,13 +372,13 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
||||
}
|
||||
}
|
||||
|
||||
static void char_callback(GLFWwindow* window, unsigned int character)
|
||||
static void char_callback(GLFWwindow* window, unsigned int codepoint)
|
||||
{
|
||||
printf("%08x at %0.3f: Character 0x%08x (%s) input\n",
|
||||
counter++,
|
||||
glfwGetTime(),
|
||||
character,
|
||||
get_character_string(character));
|
||||
codepoint,
|
||||
get_character_string(codepoint));
|
||||
}
|
||||
|
||||
void monitor_callback(GLFWmonitor* monitor, int event)
|
||||
|
Loading…
Reference in New Issue
Block a user