How do you turn this....into a switch statment....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; }
This was my attempt at it but I could not figure out the whole call to KEY_DOWN aspectCode: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; }



LinkBack URL
About LinkBacks


