Allow LK1 and LK5 to switch keyboard layout

This commit is contained in:
Stephen Saw 2018-08-07 01:43:23 +08:00
parent 6966fba1b4
commit 039e362b6d
2 changed files with 18 additions and 6 deletions

View File

@ -304,14 +304,9 @@ class Keyboard(Page):
self._LeftOrRight = -1
if self._SectionIndex >= (self._SectionNumbers -1):
self._LeftOrRight = 1
self.KeyboardShift()
self._SectionIndex -= self._LeftOrRight
self.ShiftKeyboardPage()
#print(self._SectionIndex) # on which keyboard section now
self.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Menu"]: # we assume keyboard always be child page
self.ReturnToUpLevelPage()
self._Screen.Draw()
@ -329,6 +324,16 @@ class Keyboard(Page):
self._Textarea.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["LK1"]:
if self._SectionIndex < self._SectionNumbers -1:
self._LeftOrRight = -1
self.ShiftKeyboardPage()
if event.key == CurKeys["LK5"]:
if self._SectionIndex > 0:
self._LeftOrRight = 1
self.ShiftKeyboardPage()
def Draw(self):
self.ClearCanvas()
self._Ps.Draw()
@ -340,4 +345,9 @@ class Keyboard(Page):
self._Textarea.Draw()
def ShiftKeyboardPage(self):
self.KeyboardShift()
self._SectionIndex -= self._LeftOrRight
self.Draw()
self._Screen.SwapAndShow()

View File

@ -34,6 +34,8 @@ GameShell["Space"] = pygame.K_SPACE
GameShell["Enter"] = pygame.K_k
GameShell["Start"] = pygame.K_RETURN
GameShell["LK1"] = pygame.K_h
GameShell["LK5"] = pygame.K_l
PC = {}