本文整理汇总了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)