Pass in translated ASCII characters for text input. - with glfw you can get those from the callback set in glfwSetCharCallback() - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API
| 1201 | // - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message |
| 1202 | // FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API |
| 1203 | void ImGuiIO::AddInputCharacter(unsigned int c) |
| 1204 | { |
| 1205 | ImGuiContext& g = *GImGui; |
| 1206 | IM_ASSERT(&g.IO == this && "Can only add events to current context."); |
| 1207 | if (c == 0) |
| 1208 | return; |
| 1209 | |
| 1210 | ImGuiInputEvent e; |
| 1211 | e.Type = ImGuiInputEventType_Char; |
| 1212 | e.Source = ImGuiInputSource_Keyboard; |
| 1213 | e.Text.Char = c; |
| 1214 | g.InputEventsQueue.push_back(e); |
| 1215 | } |
| 1216 | |
| 1217 | // UTF16 strings use surrogate pairs to encode codepoints >= 0x10000, so |
| 1218 | // we should save the high surrogate. |
no test coverage detected