Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the move to SDL2 seemingly caused certain button hotkeys (e.g. "pagedown") to be broken #35

Open
ipochto opened this issue Nov 4, 2021 · 0 comments

Comments

@ipochto
Copy link
Owner

ipochto commented Nov 4, 2021

https://discord.com/channels/780082494447288340/780082494447288344/905536724980072458

Andrettin:

the problem are these lines in video/sdl.cpp:

    for (i = SDLK_F1; i <= SDLK_F15; ++i) {
        snprintf(str, sizeof(str), "f%d", i - SDLK_F1 + 1);
        Key2Str[i] = str;
        snprintf(str, sizeof(str), "F%d", i - SDLK_F1 + 1);
        Str2Key[str] = i;
    }

SDLK_F13 to SDLK_F15 no longer have values adjacent to SDLK_F12
so we need two loops instead:

    for (i = SDLK_F1; i <= SDLK_F12; ++i) {
        snprintf(str.data(), sizeof(str), "f%d", i - SDLK_F1 + 1);
        Key2Str[i] = str.data();
        snprintf(str.data(), sizeof(str), "F%d", i - SDLK_F1 + 1);
        Str2Key[str.data()] = i;
    }

    for (i = SDLK_F13; i <= SDLK_F24; ++i) {
        snprintf(str.data(), sizeof(str), "f%d", i - SDLK_F13 + 13);
        Key2Str[i] = str.data();
        snprintf(str.data(), sizeof(str), "F%d", i - SDLK_F13 + 13);
        Str2Key[str.data()] = i;
    }

relevant wyrmgus commit:
Andrettin/Wyrmgus@de74fe7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant