-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
SDL3 support for pygame.system #3146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDL_Locale **
PG_GetPreferredLocales(int *num_locales)
{
#if SDL_VERSION_ATLEAST(3, 0, 0)
return SDL_GetPreferredLocales(num_locales);
#elif SDL_VERSION_ATLEAST(2, 0, 14)
SDL_Locale *locales = SDL_GetPreferredLocales();
if (locales) {
SDL_Locale *current_locale = locales;
*num_locales = 0;
/* The array is terminated when the language attribute of the last
* struct in the array is NULL */
while (current_locale->language) {
(*num_locales)++;
current_locale++;
}
return &locales;
}
#endif
return NULL;
}
Untested code, somewhat based on your idea but written so that it can be abstracted out in a separate function
SDL2: array of SDL_locales Is a pointer to an array of SDL_locales the same thing as an array of pointers to SDL_locales ? This is what I was sidestepping worrying about with my implementation but would need to think about for your code suggestion. |
okay NVM my suggestion, they are probably not the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks 🌟
A little bit more gnarly than I would like, but the code comment explains my approach here.