本文整理匯總了Python中pygame.K_9屬性的典型用法代碼示例。如果您正苦於以下問題:Python pygame.K_9屬性的具體用法?Python pygame.K_9怎麽用?Python pygame.K_9使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類pygame
的用法示例。
在下文中一共展示了pygame.K_9屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: new_demo
# 需要導入模塊: import pygame [as 別名]
# 或者: from pygame import K_9 [as 別名]
def new_demo(test=True):
import pygame
from demo.game import Game
if test is False:
game = Game(640, 480, None)
else:
def _render(game):
while True:
game.draw()
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_9:
game.increase_fps()
elif event.key == pygame.K_0:
game.decrease_fps()
pygame.init()
DISPLAYSURF = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption('Demo')
game = Game(640, 480, DISPLAYSURF)
t = Thread(target=lambda: _render(game))
t.start()
return game
示例2: new_demo
# 需要導入模塊: import pygame [as 別名]
# 或者: from pygame import K_9 [as 別名]
def new_demo(test=False):
import pygame
from demo.game import Game
if test is False:
game = Game(640, 480, None)
else:
def _render(game):
while True:
game.draw()
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_9:
game.increase_fps()
elif event.key == pygame.K_0:
game.decrease_fps()
pygame.init()
DISPLAYSURF = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption('Demo')
game = Game(640, 480, DISPLAYSURF)
t = Thread(target=lambda: _render(game))
t.start()
parameter = Parameter(lr=1e-3)
parameter.gamma = 0.9
parameter.iteration_num = 300000
parameter.num_history_frames = 1
parameter.network_type = 'mlp'
parameter.update_method = 'rmsprop'
parameter.rho = 0.95
parameter.async_update_interval = 5
parameter.input_scale = 1.0
return game, parameter