您如何确定SDL_Event循环中的哪些按钮?
我知道他们通常被称为button4和button5在许多游戏中分配它们。但是我在这里用它来检测它们呢?
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_MOUSEBUTTONDOWN: {
if (event.button.button == SDL_BUTTON_LEFT) {
mouseLeft = true;
}
else if (event.button.button == SDL_BUTTON_RIGHT) {
mouseRight = true;
}
else if (event.button.button == SDL_BUTTON_MIDDLE) {
mouseMiddle = true;
}
else if (event.button.button == MOUSE4?) {
mouse4 = true;
}
else if (event.button.button == MOUSE5?) {
mouse5 = true;
}
break;
}
}
}
答案 0 :(得分:1)