首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SDL_Event按钮类型mouse4和mouse5

SDL_Event按钮类型mouse4和mouse5
EN

Stack Overflow用户
提问于 2014-04-20 21:48:34
回答 1查看 1.7K关注 0票数 2

您用什么来确定这些按钮在SDL_Event循环中的位置?

我知道他们通常被称为button4和button5,因为他们在许多游戏中分配给他们。但我在这里放了什么来探测他们呢?

代码语言:javascript
复制
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;
        }
    }

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-20 23:10:28

你通常会读文件。

MouseButtonEvent

在这种情况下,按钮是SDL_BUTTON_X1和SDL_BUTTON_X2。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23187955

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档