1
0
Fork 0

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.
This commit is contained in:
Daniel Thompson 2020-04-05 09:31:35 +01:00
parent c593e1e9f9
commit 40b2482165

View file

@ -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()