本文整理匯總了Python中View.View.pushLayer方法的典型用法代碼示例。如果您正苦於以下問題:Python View.pushLayer方法的具體用法?Python View.pushLayer怎麽用?Python View.pushLayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類View.View
的用法示例。
在下文中一共展示了View.pushLayer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: GameEngine
# 需要導入模塊: from View import View [as 別名]
# 或者: from View.View import pushLayer [as 別名]
#.........這裏部分代碼省略.........
return True
self.config.set("video", "fullscreen", self.video.fullscreen)
return True
def restart(self):
"""Restart the game."""
if not self.restartRequested:
self.restartRequested = True
self.input.broadcastSystemEvent("restartRequested")
else:
self.quit()
def quit(self):
self.audio.close()
self.task.exit()
self.running = False
def resizeScreen(self, width, height):
"""
Resize the game screen.
@param width: New width in pixels
@param height: New height in pixels
"""
self.view.setGeometry((0, 0, width, height))
self.img.setGeometry((0, 0, width, height))
def startWorld(self):
self.world = World(self)
def finishGame(self):
self.world.finishGame()
self.world = None
self.view.pushLayer(MainMenu.MainMenu(self))
def loadImgDrawing(self, target, name, fileName, textureSize = None):
"""
Load an SVG drawing synchronously.
@param target: An object that will own the drawing
@param name: The name of the attribute the drawing will be assigned to
@param fileName: The name of the file in the data directory
@param textureSize Either None or (x, y), in which case the file will
be rendered to an x by y texture
@return: L{ImgDrawing} instance
"""
return self.data.loadImgDrawing(target, name, fileName, textureSize)
def loading(self):
"""Loading state loop."""
if self.data.essentialResourcesLoaded():
if not self.loadingScreenShown:
self.loadingScreenShown = True
Dialogs.showLoadingScreen(self, self.data.resourcesLoaded)
if self.startupLayer:
self.view.pushLayer(self.startupLayer)
self.mainloop = self.main
self.view.render()
def clearScreen(self):
self.img.clear(*Theme.backgroundColor)
def main(self):
"""Main state loop."""
示例2: GameEngine
# 需要導入模塊: from View import View [as 別名]
# 或者: from View.View import pushLayer [as 別名]
#.........這裏部分代碼省略.........
return session
def stopServer(self):
"""Stop the game server."""
if self.server:
Log.debug("Stopping server.")
self.removeTask(self.server)
self.server = None
def disconnect(self, session):
"""
Disconnect a L{Session}
param session: L{Session} to disconnect
"""
if session in self.sessions:
Log.debug("Disconnecting.")
self.removeTask(session)
self.sessions.remove(session)
def loadImgDrawing(self, target, name, fileName, textureSize = None):
"""
Load an SVG drawing synchronously.
@param target: An object that will own the drawing
@param name: The name of the attribute the drawing will be assigned to
@param fileName: The name of the file in the data directory
@param textureSize Either None or (x, y), in which case the file will
be rendered to an x by y texture
@return: L{ImgDrawing} instance
"""
return self.data.loadImgDrawing(target, name, fileName, textureSize)
def loading(self):
"""Loading state loop."""
done = Engine.run(self)
self.clearScreen()
if self.data.essentialResourcesLoaded():
if not self.loadingScreenShown:
self.loadingScreenShown = True
Dialogs.showLoadingScreen(self, self.data.resourcesLoaded)
if self.startupLayer:
self.view.pushLayer(self.startupLayer)
self.mainloop = self.main
self.view.render()
self.video.flip()
return done
def clearScreen(self):
self.img.clear(*Theme.backgroundColor)
def main(self):
"""Main state loop."""
# Tune the scheduler priority so that transitions are as smooth as possible
if self.view.isTransitionInProgress():
self.boostBackgroundThreads(False)
else:
self.boostBackgroundThreads(True)
done = Engine.run(self)
self.clearScreen()
self.view.render()
if self.debugLayer:
self.debugLayer.render(1.0, True)
self.video.flip()
return done
def run(self):
try:
return self.mainloop()
except KeyboardInterrupt:
sys.exit(0)
except SystemExit:
sys.exit(0)
except Exception, e:
def clearMatrixStack(stack):
try:
glMatrixMode(stack)
for i in range(16):
glPopMatrix()
except:
pass
if self.handlingException:
# A recursive exception is fatal as we can't reliably reset the GL state
sys.exit(1)
self.handlingException = True
Log.error("%s: %s" % (e.__class__, e))
import traceback
traceback.print_exc()
clearMatrixStack(GL_PROJECTION)
clearMatrixStack(GL_MODELVIEW)
Dialogs.showMessage(self, unicode(e))
self.handlingException = False
return True
示例3: GameEngine
# 需要導入模塊: from View import View [as 別名]
# 或者: from View.View import pushLayer [as 別名]
#.........這裏部分代碼省略.........
self.config.set("video", "fullscreen", not self.video.fullscreen)
return True
self.config.set("video", "fullscreen", self.video.fullscreen)
return True
def restart(self):
"""Restart the game."""
if not self.restartRequested:
self.restartRequested = True
self.input.broadcastSystemEvent("restartRequested")
else:
self.quit()
def resizeScreen(self, width, height):
"""
Resize the game screen.
@param width: New width in pixels
@param height: New height in pixels
"""
self.view.setGeometry((0, 0, width, height))
self.svg.setGeometry((0, 0, width, height))
def startWorld(self, players, maxplayers = None, gameMode = 0, multiMode = 0, allowGuitar = True, allowDrum = True, allowMic = False, tutorial = False):
self.world = World(self, players, maxplayers, gameMode, multiMode, allowGuitar, allowDrum, allowMic, tutorial)
def finishGame(self):
if not self.world:
Log.notice("GameEngine.finishGame called before World created.")
return
self.world.finishGame()
self.world = None
self.gameStarted = False
self.view.pushLayer(self.mainMenu)
def loadImgDrawing(self, target, name, fileName, textureSize = None):
"""
Load an SVG drawing synchronously.
@param target: An object that will own the drawing
@param name: The name of the attribute the drawing will be assigned to
@param fileName: The name of the file in the data directory
@param textureSize: Either None or (x, y), in which case the file will
be rendered to an x by y texture
@return: L{ImgDrawing} instance
"""
return self.data.loadImgDrawing(target, name, fileName, textureSize)
#volshebnyi
def drawStarScore(self, screenwidth, screenheight, xpos, ypos, stars, scale = None, horiz_spacing = 1.2, space = 1.0, hqStar = False, align = LEFT):
minScale = 0.02
w = screenwidth
h = screenheight
if not scale:
scale = minScale
elif scale < minScale:
scale = minScale
if self.data.fcStars and stars == 7:
star = self.data.starFC
else:
star = self.data.starPerfect
wide = scale * horiz_spacing
if align == CENTER: #center - akedrou (simplifying the alignment...)
xpos -= (2 * wide)
elif align == RIGHT: #right
xpos -= (4 * wide)