MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / AddInputCharacter

Method AddInputCharacter

engine/3rdparty/imgui/imgui.cpp:1203–1215  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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
1203void 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.

Callers 4

PollUnicodeCharsFunction · 0.80

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected