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
| 1223 | // - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message |
| 1224 | // FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API |
| 1225 | void ImGuiIO::AddInputCharacter(unsigned int c) |
| 1226 | { |
| 1227 | ImGuiContext& g = *GImGui; |
| 1228 | IM_ASSERT(&g.IO == this && "Can only add events to current context."); |
| 1229 | if (c == 0 || !AppAcceptingEvents) |
| 1230 | return; |
| 1231 | |
| 1232 | ImGuiInputEvent e; |
| 1233 | e.Type = ImGuiInputEventType_Text; |
| 1234 | e.Source = ImGuiInputSource_Keyboard; |
| 1235 | e.Text.Char = c; |
| 1236 | g.InputEventsQueue.push_back(e); |
| 1237 | } |
| 1238 | |
| 1239 | // UTF16 strings use surrogate pairs to encode codepoints >= 0x10000, so |
| 1240 | // we should save the high surrogate. |
no test coverage detected