Вопрос

What do you put to figure out which buttons these are in the SDL_Event loop? enter image description here

I know they are usually known as button4 and button5 from assigning them in many games. But what do I put in here to detect them?

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;
        }
    }

}
Это было полезно?

Решение

You would usually read the documentation.

http://wiki.libsdl.org/SDL_MouseButtonEvent

In this case the buttons are SDL_BUTTON_X1 and SDL_BUTTON_X2

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top