Update terminis.py
This commit is contained in:
parent
03dcb3a568
commit
8eaef22452
@ -511,20 +511,24 @@ class ControlsParser(configparser.SafeConfigParser):
|
|||||||
# See https://docs.python.org/3/library/curses.html?highlight=curses#constants
|
# See https://docs.python.org/3/library/curses.html?highlight=curses#constants
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
DEFAULTS = {
|
||||||
|
"MOVE LEFT": "KEY_LEFT",
|
||||||
|
"MOVE RIGHT": "KEY_RIGHT",
|
||||||
|
"SOFT DROP": "KEY_DOWN",
|
||||||
|
"HARD DROP": "SPACE",
|
||||||
|
"ROTATE CLOCKWISE": "ENTER",
|
||||||
|
"ROTATE COUNTER": "KEY_UP",
|
||||||
|
"HOLD": "h",
|
||||||
|
"PAUSE": "p",
|
||||||
|
"QUIT": "q"
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
configparser.SafeConfigParser.__init__(self)
|
configparser.SafeConfigParser.__init__(self)
|
||||||
self.optionxform = str
|
self.optionxform = str
|
||||||
self.add_section(self.SECTION)
|
self.add_section(self.SECTION)
|
||||||
self["MOVE LEFT"] = "KEY_LEFT"
|
for action, key in self.DEFAULTS.items():
|
||||||
self["MOVE RIGHT"] = "KEY_RIGHT"
|
self[action] = key
|
||||||
self["SOFT DROP"] = "KEY_DOWN"
|
|
||||||
self["HARD DROP"] = "SPACE"
|
|
||||||
self["ROTATE COUNTER"] = "KEY_UP"
|
|
||||||
self["ROTATE CLOCKWISE"] = "ENTER"
|
|
||||||
self["HOLD"] = "h"
|
|
||||||
self["PAUSE"] = "p"
|
|
||||||
self["QUIT"] = "q"
|
|
||||||
|
|
||||||
if not os.path.exists(self.FILE_PATH):
|
if not os.path.exists(self.FILE_PATH):
|
||||||
self.reset()
|
self.reset()
|
||||||
@ -728,6 +732,7 @@ class Game:
|
|||||||
color = curses.color_pair(color)|curses.A_REVERSE if color else curses.color_pair(Color.BLACK)
|
color = curses.color_pair(color)|curses.A_REVERSE if color else curses.color_pair(Color.BLACK)
|
||||||
self.matrix.window.addstr(y, x*2+1, char, color)
|
self.matrix.window.addstr(y, x*2+1, char, color)
|
||||||
self.matrix.window.refresh()
|
self.matrix.window.refresh()
|
||||||
|
curses.beep()
|
||||||
self.scr.timeout(-1)
|
self.scr.timeout(-1)
|
||||||
while self.scr.getkey() != self.controls["QUIT"]:
|
while self.scr.getkey() != self.controls["QUIT"]:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user