Text input
fhoenig opened this issue · 1 comments
fhoenig commented
Project looks great and clean. However, how do you handle char input?
WM_UNICHAR etc.
alaingalvan commented
Hey @fhoenig, currently for Win32 key events are propigated at:
So should your application need to type out character input you can listen to these events and call xwin::convertKeyToString(xwin::Key key);
if (e.type == xwin::EventType::Keyboard)
{
xwin::KeyboardData& kd = e.data.keyboard;
size_t kid = static_cast<size_t>(kd.key);
if (kid < 256)
{
if (kd.state == xwin::ButtonState::Released)
{
charBuf += xwin::convertKeyToString(kd.key);
}
}
}
EDIT: I'll update the sister repo's examples to include an instance of character input using ImGui.