Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text input #4

Open
fhoenig opened this issue Jul 9, 2020 · 1 comment
Open

Text input #4

fhoenig opened this issue Jul 9, 2020 · 1 comment

Comments

@fhoenig
Copy link

fhoenig commented Jul 9, 2020

Project looks great and clean. However, how do you handle char input?
WM_UNICHAR etc.

@alaingalvan
Copy link
Owner

alaingalvan commented Jul 10, 2020

Hey @fhoenig, currently for Win32 key events are propigated at:

Win32EventQueue.cpp Line 349

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants