Hi,
I am coding my own engine, for fun, in C++ and dx11. It is only a 2d engine, so not a very big deal. Tho I am wondering what the best way for input is. I came up with a solution like this (Stole the code from sfml)
Normal keys (skills, chat, jumping etc)
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
{
if (m_repeat || ((HIWORD(lParam) & KF_REPEAT) == 0))
{
// push the event onto the stack
}
break;
}
// Keyup event
case WM_KEYUP:
case WM_SYSKEYUP:
{
// push event onto the stack, doubt i will need this much tho
}
// use this for moving and maybe some special cases (skills), my game can check for keys manally like
bool InputImpl::isKeyPressed(Keyboard::Key key)
{
int vkey = 0;
switch (key)
{
default: vkey = 0; break;
case Keyboard::A: vkey = 'A'; break;
}
return (GetAsyncKeyState(vkey) & 0x8000) != 0;
}
Since it is only 2d and raw input seemed to be a lot more irritating, is this a fine solution?
gr