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:
from keysyms import *
Next, it can be used in key processing:
def keyDown( key ): # if arrow keys have changed, store them in our global variables if key == K_LEFT: global leftDown leftDown = 1 elif key == K_RIGHT: global rightDown rightDown = 1 elif key == K_UP: global upDown upDown = 1 elif key == K_DOWN: global downDown downDown = 1 elif key == K_ESCAPE: global doExit doExit = 1
Thanks!
Log in to post a comment.
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!