c++ 小游戏如何实现斜方向移动(同时检测两个按键
问题:在控制player移动时使用_getch()获取按键->判断->更改坐标。但无法同时获取两个按键事件
改进:使用GetKeyState(nVirtKey)检测是否按下对应虚拟键
#define isKeyPressed(nVirtKey) (GetKeyState(nVirtKey) & (1<<(sizeof(SHORT)*8-1))) != 0
using namespace std;
int main() {
const char* str = "hello world"