1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Clarified character callback parameter.

This commit is contained in:
Camilla Berglund 2013-10-10 19:41:56 +02:00
parent 7dd8770e6f
commit 2c920fbb8b
4 changed files with 11 additions and 11 deletions

View File

@ -765,7 +765,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
* This is the function signature for Unicode character callback functions. * This is the function signature for Unicode character callback functions.
* *
* @param[in] window The window that received the event. * @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 * @sa glfwSetCharCallback
* *

View File

@ -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); 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; return;
if (window->callbacks.character) if (window->callbacks.character)
window->callbacks.character((GLFWwindow*) window, character); window->callbacks.character((GLFWwindow*) window, codepoint);
} }
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)

View File

@ -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. /*! @brief Notifies shared code of a Unicode character input event.
* @param[in] window The window that received the 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 * @ingroup event
*/ */
void _glfwInputChar(_GLFWwindow* window, unsigned int character); void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint);
/*! @brief Notifies shared code of a scroll event. /*! @brief Notifies shared code of a scroll event.
* @param[in] window The window that received the event. * @param[in] window The window that received the event.

View File

@ -228,12 +228,12 @@ static const char* get_mods_name(int mods)
return name; 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 // This assumes UTF-8, which is stupid
static char result[6 + 1]; static char result[6 + 1];
int length = wctomb(result, character); int length = wctomb(result, codepoint);
if (length == -1) if (length == -1)
length = 0; 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", printf("%08x at %0.3f: Character 0x%08x (%s) input\n",
counter++, counter++,
glfwGetTime(), glfwGetTime(),
character, codepoint,
get_character_string(character)); get_character_string(codepoint));
} }
void monitor_callback(GLFWmonitor* monitor, int event) void monitor_callback(GLFWmonitor* monitor, int event)