如何检测在 C++ SDL 中按下了什么鼠标键?
How to detect what mouse key is pressed in C++ SDL?
如何确定按下了哪个鼠标按钮(右、左、中等)?我正在使用 SDL。这是我的代码,它说明是否单击了任何鼠标按钮:
case SDL_MOUSEBUTTONDOWN:
{
Mouse_Pressed = event.button.clicks;
} break;
case SDL_MOUSEBUTTONUP:
{
Mouse_Pressed = 0;
} break;
您可以通过事件 按钮 字段访问它。
case SDL_MOUSEBUTTONUP:
switch ( ev.button.button ) {
case SDL_BUTTON_LEFT:
break;
case SDL_BUTTON_RIGHT:
break;
case SDL_BUTTON_MIDDLE:
break;
case SDL_BUTTON_X1:
break;
case SDL_BUTTON_X2:
break;
}
如何确定按下了哪个鼠标按钮(右、左、中等)?我正在使用 SDL。这是我的代码,它说明是否单击了任何鼠标按钮:
case SDL_MOUSEBUTTONDOWN:
{
Mouse_Pressed = event.button.clicks;
} break;
case SDL_MOUSEBUTTONUP:
{
Mouse_Pressed = 0;
} break;
您可以通过事件 按钮 字段访问它。
case SDL_MOUSEBUTTONUP:
switch ( ev.button.button ) {
case SDL_BUTTON_LEFT:
break;
case SDL_BUTTON_RIGHT:
break;
case SDL_BUTTON_MIDDLE:
break;
case SDL_BUTTON_X1:
break;
case SDL_BUTTON_X2:
break;
}