Skip to content

Commit

Permalink
pysdl2 example complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmunday committed Aug 5, 2017
1 parent 1bc4d7f commit 7746edb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions Authors
Expand Up @@ -13,3 +13,4 @@ Greg Farrell <gregfarrell.org@@gmail.com>
Finn Hughes <finn.hughes1@@gmail.com>
Marcelo Fernandez <fernandezm@@gmail.com>
Simon Hatt <9hatt2@@gmail.com>
Neil Munday <www.mundayweb.com>
20 changes: 14 additions & 6 deletions examples/pysdl2.py
Expand Up @@ -4,6 +4,10 @@
Only handles mouse events but could be extended to handle others.
Requires pysdl2 (and SDL2 library).
Tested configurations:
- SDL2 2.0.5 with PySDL2 0.9.3 on Fedora 25 (x86_64)
- SDL2 with PySDL2 0.9.5 on Ubuntu 14.04
Install instructions.
Expand All @@ -20,16 +24,17 @@
2. Install PySDL via PIP:
sudo pip2 install PySDL2
Tested configurations:
- SDL2 2.0.5 with PySDL2 0.9.3 on Fedora 25 (x86_64)
- SDL2 with PySDL2 0.9.5 on Ubuntu 14.04
Event handling:
Where possible SDL2 events are mapped to CEF ones. Not all keyboard
modifiers are handled in this example but these could be
add by the reader (if desired).
added by the reader (if desired). Modifiers that do not work
for example:
- Ctrl
- Mouse dragging
- Marking text inputs with the shift key
Due to SDL2's lack of GUI widgets there are no GUI controls
for the user. However, as an exercise this example could
Expand Down Expand Up @@ -265,7 +270,10 @@ def getKeyCode(key):
if key in keyMap:
return keyMap[key]
# Key not mapped, raise exception
print("Keyboard mapping incomplete: unsupported SDL key %d. See https://wiki.libsdl.org/SDLKeycodeLookup for mapping." % key)
print("Keyboard mapping incomplete: \
unsupported SDL key %d. \
See https://wiki.libsdl.org/SDLKeycodeLookup for mapping."
% key)
return None

class LoadHandler(object):
Expand Down

0 comments on commit 7746edb

Please sign in to comment.