本文整理汇总了Python中keyboard.Keyboard.get_pressed方法的典型用法代码示例。如果您正苦于以下问题:Python Keyboard.get_pressed方法的具体用法?Python Keyboard.get_pressed怎么用?Python Keyboard.get_pressed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keyboard.Keyboard
的用法示例。
在下文中一共展示了Keyboard.get_pressed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_game
# 需要导入模块: from keyboard import Keyboard [as 别名]
# 或者: from keyboard.Keyboard import get_pressed [as 别名]
def start_game(self):
while 1 :
if self.toSetGameScreen != None :
self.currGameScreen = self.toSetGameScreen
self.toSetGameScreen = None
if self.currGameScreen == None :
raise Exception("currGameScreen for game is not set")
for event in pygame.event.get() :
if event.type == pygame.QUIT:
FileDirHelper.delete_dir(self.GAME_DIRECTORY + Default.TMP_FOLDER)
sys.exit()
Keyboard.get_pressed()
if Keyboard.is_down(pygame.K_LCTRL) and Keyboard.is_down(pygame.K_d) :
DebugHelper.run_debugger()
if Keyboard.is_down(pygame.K_LCTRL) and Keyboard.is_down(pygame.K_s) :
MainMenuHelper.save_game(self)
Keyboard.get_pressed()
for gameObject in self.currGameScreen.activeObjects.values() :
gameObject.analyze_state()
for gameObject in self.currGameScreen.activeObjects.values() :
gameObject.interpret_state()
self.currGameScreen.refreshScreen()
#obj1 = Game.currGameScreen.activeObjects[2]
#obj2 = Game.currGameScreen.activeObjects[4]
#DebugHelper.draw_borders(Game.currGameScreen.surface, obj1)
#DebugHelper.draw_borders(Game.currGameScreen.surface, obj2)