当前位置: 首页>>代码示例>>Python>>正文


Python Game.write_text方法代码示例

本文整理汇总了Python中myrmidon.Game.write_text方法的典型用法代码示例。如果您正苦于以下问题:Python Game.write_text方法的具体用法?Python Game.write_text怎么用?Python Game.write_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在myrmidon.Game的用法示例。


在下文中一共展示了Game.write_text方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute

# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import write_text [as 别名]
 def execute(self, window):
     self.window = window
     self.text = Game.write_text(Game.screen_resolution[0] / 2, Game.screen_resolution[1] / 2, text = "d  i  a  g  o  n  e  x", font = self.window.media.fnt['title_name'], alignment = ALIGN_CENTRE)
     self.text.z = -10
     self.text.alpha = 0.0
     self.window.media.mus['title'].sound.play(loops = -1)
     for frame, total in Game.timer_ticks(30):
         yield
     for frame, total in Game.timer_ticks(30):
         self.text.alpha = Game.lerp(0.0, 1.0, frame / total)
         yield
     self.text2 = Game.write_text(Game.screen_resolution[0] / 2, (Game.screen_resolution[1] / 2) + 200, text = "press start", font = self.window.media.fnt['title_press_start'], alignment = ALIGN_CENTRE)
     self.text2.z = -10
     self.text2.alpha = 0.0
     for frame, total in Game.timer_ticks(30):
         self.text2.alpha = Game.slerp(0.0, 1.0, frame / total)
         yield
     while True:
         if self.window.pressed_start():
             self.window.media.sfx['pressstart'].sound.play()
             break
         yield
     for frame, total in Game.timer_ticks(20):
         self.text.alpha = Game.slerp(1.0, 0.0, frame / total)
         self.text2.alpha = Game.slerp(1.0, 0.0, frame / total)
         yield
     self.window.change_state(Window.STATE_SELECT_PLAYERS)
     self.destroy()
开发者ID:Fiona,项目名称:Diagonex,代码行数:30,代码来源:__main__.py

示例2: _setup

# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import write_text [as 别名]
 def _setup(self):
     TextTest._setup(self)
     self.text.destroy()
     t1 = Game.write_text(self.x-10, self.y-10, font=Application.F_BIG, text="test", alignment=ALIGN_CENTRE)
     t1.colour = (0.75, 0.75, 0.75)
     t1.blend = True
     t2 = Game.write_text(self.x+00, self.y+00, font=Application.F_BIG, text="test", alignment=ALIGN_CENTRE)
     t2.colour = (0.75, 0.75, 0.75)
     t2.blend = True
     t3 = Game.write_text(self.x+10, self.y+10, font=Application.F_BIG, text="test", alignment=ALIGN_CENTRE)
     t3.colour = (0.75, 0.75, 0.75)
     t3.blend = True
开发者ID:Fiona,项目名称:Myrmidon,代码行数:14,代码来源:feature_test.py

示例3: execute

# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import write_text [as 别名]
 def execute(self, position):
     self.x, self.y = position
     self.image = Application.G_WORD
     self.desc_obj = Game.write_text(self.x, self.y+self.TEXT_OFFSET, Application.F_MAIN, ALIGN_TOP,
                                     self.description)
     self.desc_obj.colour = (1, 1, 1)
     self._setup()
     while True:
         self._update()
         yield
开发者ID:Fiona,项目名称:Myrmidon,代码行数:12,代码来源:feature_test.py

示例4: execute

# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import write_text [as 别名]
 def execute(self, window):
     self.window = window
     self.text = Game.write_text(
         Game.screen_resolution[0] / 2, 100, self.window.F_BENCHMARK_NAME, ALIGN_CENTER, self.name
     )
     self.average_execution_time = 0.0
     self.average_render_time = 0.0
     self.test_entities = []
     for entity_num in range(self.num_test_entities):
         self.create_single_test_entity()
     self.switch_state("run_test")
开发者ID:fangbei,项目名称:Myrmidon,代码行数:13,代码来源:benchmark.py

示例5: execute

# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import write_text [as 别名]
 def execute(self):
     self.graphics = {
         "ship" : Game.load_image(os.path.join("media", "ship.png")),
         "shot" : Game.load_image(os.path.join("media", "shot.png"))
         }
     self.font = Game.load_font(size = 50)        
     Ship(self)
     self.fps_text = Game.write_text(0.0, 0.0, font = self.font, text = 0)
     self.entity_text = Game.write_text(0.0, 40.0, font = self.font, text = 0)
     Game.write_text(
         512.0, 730.0,
         font = self.font,
         text = "Hold space to produce more entities",
         alignment = ALIGN_CENTRE
         )
     while True:            
         if Game.keyboard_key_down(K_ESCAPE):
             sys.exit()                
         self.pattern_vortex(300.0, 300.0, 1)
         self.pattern_vortex(700.0, 300.0)
         self.fps_text.text = "FPS " + str(Game.fps)
         self.entity_text.text = str(len(Game.entity_list)) + " entities"            
         yield
开发者ID:arcticshores,项目名称:Myrmidon,代码行数:25,代码来源:complex_example.py

示例6: execute

# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import write_text [as 别名]
    def execute(self):
        self.graphics = {
            "ship": Game.load_image(os.path.join("media", "ship.png")),
            "shot": Game.load_image(os.path.join("media", "shot.png")),
        }
        self.font = Game.load_font(size=50)
        # Ship(self)
        self.fps_text = Game.write_text(0.0, 0.0, font=self.font, text=0)
        self.entity_text = Game.write_text(0.0, 40.0, font=self.font, text=0)
        Game.write_text(
            512.0, 730.0, font=self.font, text="Hold space to produce more entities", alignment=ALIGN_CENTRE
        )
        # add bounds
        sx = Game.screen_resolution[0]
        sy = Game.screen_resolution[1]
        seg1 = Segment(space.static_body, Vec2d(0, 0), Vec2d(0, sy), 0)
        seg1.elasticity = 1.0
        seg1.friction = 1.0

        seg2 = Segment(space.static_body, Vec2d(0, sy), Vec2d(sx, sy), 0)
        seg2.elasticity = 1.0
        seg2.friction = 1.0

        seg3 = Segment(space.static_body, Vec2d(sx, sx), Vec2d(sx, 0), 0)
        seg3.elasticity = 1.0
        seg3.friction = 1.0

        # add everything into space
        space.add_static(seg1, seg2, seg3)
        while True:
            if Game.keyboard_key_down(K_ESCAPE):
                sys.exit()
            space.step(0.1)  # TODO - use actual time delta
            self.pattern_vortex(300.0, 300.0, 1)
            self.fps_text.text = "FPS " + str(Game.current_fps)
            self.entity_text.text = str(len(Game.entity_list)) + " entities"
            yield
开发者ID:fangbei,项目名称:Myrmidon,代码行数:39,代码来源:cymunk_balls.py


注:本文中的myrmidon.Game.write_text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。