Pdr
Topic Author
Posts: 8
Joined: 29 Sep 2025, 16:31

Question about KeyDown/Up events

15 Oct 2025, 16:27

Hey.

So I don't really understand the Noesis::Key enum and what it's expecting to be sent to it. I'm trying to implement the Noesis::IView::KeyDown/Up calls from the MessageLoop's WM_KEYDOWN/WM_KEYUP messages. From those I can get the virtual_key, scan_code and some other stuff. But nothing seems to be mapping appropriately to the Key enum expected by Noesis. Is there any remapping function hidden somewhere or what are we supposed to be doing here? Currently all normal ascii input on the keyboard works fine by simply passing the virtual_key to KeyDown (for some reason, since they absolutely don't match?), Then calling Char on WM_CHAR and then KeyUp on WM_KEYUP. But none of the other keys work, like backspace, return, arrows etc etc.
 
User avatar
jsantos
Site Admin
Posts: 4825
Joined: 20 Jan 2012, 17:18
Contact:

Re: Question about KeyDown/Up events

15 Oct 2025, 17:06

I recommend having a look at our windows implementation for this (Win32Display.cpp):
case WM_KEYDOWN:
{
    if (wParam <= 0xff && mKeyTable[wParam] != 0)
    {
        mKeyDown(this, (Key)mKeyTable[wParam]);
    }

    return false;
}
case WM_KEYUP:
{
    if (wParam <= 0xff && mKeyTable[wParam] != 0)
    {
        mKeyUp(this, (Key)mKeyTable[wParam]);
    }

    return false;
}
case WM_CHAR:
{
    mChar(this, (uint32_t)wParam);
    return false;
}

Who is online

Users browsing this forum: No registered users and 36 guests