Python Demo 1 work not correctly - SDL and Windows keycodes are different. At this moment, I made simple pygame.locals-like file from SDL_keysym.h (tried to use pygame.locals directly, but there were some errors).
defkeyDown(key):# if arrow keys have changed, store them in our global variablesifkey==K_LEFT:globalleftDownleftDown=1elifkey==K_RIGHT:globalrightDownrightDown=1elifkey==K_UP:globalupDownupDown=1elifkey==K_DOWN:globaldownDowndownDown=1elifkey==K_ESCAPE:globaldoExitdoExit=1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Python Demo 1 work not correctly - SDL and Windows keycodes are different. At this moment, I made simple pygame.locals-like file from SDL_keysym.h (tried to use pygame.locals directly, but there were some errors).
Oops, sorry for formatting with tabs…
This code is easy to use - write it down, for example, in file "keysyms.py", and import it in the game:
Next, it can be used in key processing:
Thanks!