Need help turning this if sequence into a switch case
How do you turn this....
Code:
//macros to read the keyboard asynchronously
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEY_UP(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
if (KEY_DOWN(VK_RIGHT))
{
right = right + 1;
left = left + 1;
}
if (KEY_DOWN(VK_LEFT))
{
right = right -1;
left = left - 1;
}
if (KEY_DOWN(VK_UP))
{
top = top - 1;
bottom = bottom - 1;
}
if (KEY_DOWN(VK_DOWN))
{
bottom = bottom + 1;
top = top + 1;
}
into a switch statment....
This was my attempt at it but I could not figure out the whole call to KEY_DOWN aspect
Code:
switch (KEY_DOWN())
{
case VK_RIGHT;
right = right + 1;
left = left + 1;
break;
case VK_LEFT;
right = right -1;
left = left - 1;
break;
case VK_UP;
top = top - 1;
bottom = bottom - 1;
break;
case VK_DOWN;
bottom = bottom + 1;
top = top + 1;
break;
default:
break;
}