-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add K_AC_BACK key constant, fix data_file pruning and "STRIPPED" install. #2311
Conversation
How can this be tested? |
the typo date_files->data_files, the extensional list of data files when stripped, or the back button constant? |
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.
Nice one :)
Just a small idea in case you want to make stuff more compact. Of all the icon files you are loading, only pygame_icon.bmp is actually used by pygame (and pygame_icon.tiff is additionally used on Mac). All other files need not be included (which can save about 200 kB), and the tiff file can be conditionally included on Mac only (can save about 60 kB more on non-Mac platforms)
And adding type hints for the new constant you added, will make @MightyJosip happy :)
This PR also needs the new keycode added to Yes, it's kind of annoying we have keycode stuff in four different places but that's how it is right now. |
@@ -181,6 +181,7 @@ that your key handling code works well on both pygame 1 and pygame 2. | |||
K_MENU menu | |||
K_POWER power | |||
K_EURO Euro | |||
K_AC_BACK Android back button |
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.
Is it Android specific? I thought those worked on keyboards too?
https://wiki.libsdl.org/SDL_ScancodeAndKeycode
"AC Back" (the Back key (application control keypad)).
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.
I guess I'll have to try this with a flirc and also a RF multimedia remote. I'll report back later
Possibly relatedly, do we also need to be aware of this SDL hint?
Looks like it may have been set to 1 in p4a here: kivy/python-for-android#1528 though I'm not aware of how that all interacts with pygame. |
AFAIK, p4a sets that setting by default, so there's nothing here to document. I'll look into p4a when I have time. As for multimedia keyboards, I don't know how often you use them with PyGame. I thought the more important use case for that constant is android, but if some people can generate it on PC, we probably should document that you can't rely on this event to only happen on Android. iOS doesn't have a back button, and the "back" button on the xbox gamepad doesn't trigger this event on PC. Once this PR and #2250 are merged, I'll start working on PyGame+openGL on android, and then I'll write a couple of tutorials that focus on the code side of writing PyGame games for android. (Installing the tool chain is a completely different beast. It should be easy enough if you know your UNIX command line, but it is definitely orders of magnitude more difficult than In my own games, I currently write import pygame
pygame.init()
pygame.K_AC_BACK=1073742094 but that's not a long-term solution and not something I'd want to use in tutorials. To fix the build on SDL1.2, can I just declare |
I managed to find a back button on my multimedia remote that indeed creates this keycode/scancode. I don't have a keyboard that has this key, but some people might. I still think we should mention Android somewhere, as the main reason this is included is Android, and Escape would be used for the same purposes on PC platforms. I'll change the description. |
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.
👍 Danke tausenddreihundertsiebenunddreißig!
fix typo in setup.py, and expose android back button as constant.
(Sorry, I forgot to push this last commit in my android PR before 2.0)