diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-04-05 08:31:35 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-04-06 21:04:20 (GMT) |
| commit | 40b2482165079ef3574e1ad256e5edecba3551f1 (patch) | |
| tree | d80aa664555b6dd5afe590e0eec379c07c18d70d /wasp/boards/simulator/display.py | |
| parent | c593e1e9f92963d0058de148930549f5e050490a (diff) | |
wasp: simulator: Swap up/down and left/right
This gives the simulator a more natural feel since the "swipe left" action
usually means "more a screen to the right". This will probably make
testing games impossible but makes it much easier to navigate the menus.
Diffstat (limited to 'wasp/boards/simulator/display.py')
| -rw-r--r-- | wasp/boards/simulator/display.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/wasp/boards/simulator/display.py b/wasp/boards/simulator/display.py index 1a1e0c9..7fdbef6 100644 --- a/wasp/boards/simulator/display.py +++ b/wasp/boards/simulator/display.py @@ -86,14 +86,22 @@ class CST816SSim(): self.regs[1] = 0 def handle_key(self, key): + """Use key presses to provoke different touchscreen events. + + Note: The Down key provokes an upward swipe and vice versa. + Same for left and right. That is because the swipe up + gesture means show me the screen the is below me (hence + the controls are inverted compared to joystick-like + direction control). + """ if key.keysym.sym == sdl2.SDLK_DOWN: - self.regs[1] = 1 - elif key.keysym.sym == sdl2.SDLK_UP: self.regs[1] = 2 + elif key.keysym.sym == sdl2.SDLK_UP: + self.regs[1] = 1 elif key.keysym.sym == sdl2.SDLK_LEFT: - self.regs[1] = 3 - elif key.keysym.sym == sdl2.SDLK_RIGHT: self.regs[1] = 4 + elif key.keysym.sym == sdl2.SDLK_RIGHT: + self.regs[1] = 3 self.regs[3] = 0x80 self.raise_interrupt() |
