本文整理匯總了Python中Scene.Scene.run方法的典型用法代碼示例。如果您正苦於以下問題:Python Scene.run方法的具體用法?Python Scene.run怎麽用?Python Scene.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Scene.Scene
的用法示例。
在下文中一共展示了Scene.run方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: DanceCV
# 需要導入模塊: from Scene import Scene [as 別名]
# 或者: from Scene.Scene import run [as 別名]
class DanceCV():
def __init__(self, song, speed):
self.input = Input()
self.resource = Resource()
self.audio = Audio()
self.audio.pre_open()
pygame.init()
self.audio.open()
if song != None:
self.song = loadSong(self.resource, song)
else:
self.song = loadSong(self.resource, "gangnam")
self.clock = pygame.time.Clock()
pygame.display.set_mode((Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT))
pygame.display.set_caption("DanceCV")
screen = pygame.display.get_surface()
if speed != None:
self.scene = Scene(self.resource, self.song, screen, self.input, speed)
else:
self.scene = Scene(self.resource, self.song, screen, self.input, 2)
def run(self):
while True:
for events in pygame.event.get():
if events.type == QUIT:
sys.exit(0)
self.input.run()
self.scene.run()
pygame.display.update()
self.clock.tick(30)
示例2: run
# 需要導入模塊: from Scene import Scene [as 別名]
# 或者: from Scene.Scene import run [as 別名]
def run(self, ticks):
if self.cmdPlay:
self.startGame()
return
if len(self.engine.world.songQueue) > 0 and self.queued:
self.startGame(fromQueue=True)
return
if self.gameStarted or self.items == []:
return
Scene.run(self, ticks)
if self.queued:
self.queued = False
if self.scrolling:
self.scrollTime -= ticks
if self.scrollTime < 0:
self.scrollTime = self.scrollRate
self.scroller[self.scrolling]()
if self.mode == 0:
if self.previewDelay > 0 and self.autoPreview:
self.previewDelay -= ticks
if self.previewDelay < 0:
self.previewDelay = 0
if not self.previewLoaded and self.previewDelay == 0:
self.previewSong()
d = self.cameraOffset - self.selectedOffset
self.cameraOffset -= d * ticks / 192.0
for i in range(len(self.itemRenderAngles)):
if i == self.selectedIndex:
self.itemRenderAngles[i] = min(90, self.itemRenderAngles[i] + ticks / 2.0)
else:
self.itemRenderAngles[i] = max(0, self.itemRenderAngles[i] - ticks / 2.0)
if self.moreInfo:
self.moreInfoTime += ticks
elif self.moreInfoTime > 0:
self.moreInfoTime -= ticks
if self.moreInfoTime < 0:
self.moreInfoTime = 0
self.engine.theme.setlist.run(ticks)