本文整理汇总了Python中Menu.Menu.showMenu方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.showMenu方法的具体用法?Python Menu.showMenu怎么用?Python Menu.showMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu.Menu
的用法示例。
在下文中一共展示了Menu.showMenu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GameControl
# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import showMenu [as 别名]
class GameControl(ShowBase):
"""
controlling the game itself, menu, editors level selection... it's sorta a fake-fsm.
did i mention i dont like fsm's and prefer totaly whicked logic instead?
"""
def __init__(self):
load_prc_file_data("", "textures-power-2 none")
load_prc_file_data("", "win-size 1600 900")
# load_prc_file_data("", "fullscreen #t")
load_prc_file_data("", "window-title cuboid")
load_prc_file_data("", "icon-filename res/icon.ico")
# I found openal works better for me
load_prc_file_data("", "audio-library-name p3openal_audio")
# ------ Begin of render pipeline code ------
# Insert the pipeline path to the system path, this is required to be
# able to import the pipeline classes
pipeline_path = "../../"
# Just a special case for my development setup, so I don't accidentally
# commit a wrong path. You can remove this in your own programs.
if not os.path.isfile(os.path.join(pipeline_path, "setup.py")):
pipeline_path = "../../RenderPipeline/"
sys.path.insert(0, pipeline_path)
# Use the utility script to import the render pipeline classes
from rpcore import RenderPipeline
self.render_pipeline = RenderPipeline()
self.render_pipeline.mount_mgr.mount()
self.render_pipeline.load_settings("/$$rpconfig/pipeline.yaml")
self.render_pipeline.settings["pipeline.display_debugger"] = False
self.render_pipeline.set_empty_loading_screen()
self.render_pipeline.create(self)
# [Optional] use the default skybox, you can use your own skybox as well
# self.render_pipeline.create_default_skybox()
# ------ End of render pipeline code, thats it! ------
# Set time of day
self.render_pipeline.daytime_mgr.time = 0.812
self.menu = Menu(self)
self.level = Level(self)
self.cube = Cube(self.level)
self.camControl = CamControl(self.cube)
self.gui = GUI(self)
self.menu.showMenu()
base.accept("i",self.camControl.zoomIn)
base.accept("o",self.camControl.zoomOut)
def startGame(self,level=0):
#debug purpose only: to directly play a certian lvl number
from sys import argv
if len(argv) >1:
level = int(argv[1])
self.menu.hideMenu()
self.level.loadLevel(level)
self.cube.resetCube()
self.cube.resetStats()
self.cube.enableGameControl()
base.accept("escape", self.pauseGame)
def pauseGame(self):
self.cube.disableGameControl()
self.menu.showMenu()
self.menu.showResume()
#base.accept("escape", self.resumeGame )
def resumeGame(self):
self.menu.hideMenu()
self.menu.hideResume()
self.cube.enableGameControl()
base.accept("escape", self.pauseGame)
def levelEnd(self):
self.cube.disableGameControl()
self.menu.showMenu()
示例2: Menu
# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import showMenu [as 别名]
# game variable
gameVariable = GameVariable.GameVariable()
hero = GameSprite.Hero(250,250,images)
#hracie okno
displayWidth = images.background.get_rect().width
displayHeight = images.background.get_rect().height
spellBook = Spell.SpellBook(0,displayHeight,displayWidth,displayHeight // 5,len(hero.cooldown),images,hero)
gameDisplay = pygame.display.set_mode((displayWidth,displayHeight+spellBook.height),0,32)
#menu
menu = Menu(gameDisplay,gameVariable,images)
menu.showTutorial()
menu.showMenu()
hero.x = gameVariable.x
hero.y = gameVariable.y
hero.hp = gameVariable.hp
hero.level = gameVariable.level
#font
font = pygame.font.SysFont("Arial",30)
text = font.render('Hello WORLD',True,(150,150,150))
kolizia = Collision.CollisionDetect(hero,displayWidth,displayHeight)
delayPohyb = 0