本文整理汇总了Python中myrmidon.Game.load_font方法的典型用法代码示例。如果您正苦于以下问题:Python Game.load_font方法的具体用法?Python Game.load_font怎么用?Python Game.load_font使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myrmidon.Game
的用法示例。
在下文中一共展示了Game.load_font方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import load_font [as 别名]
def __init__(self):
self.gfx['player'] = Game.load_image(os.path.join("gfx", "player.png"), sequence = True, width = 64, height = 64)
self.gfx['grid'] = Game.load_image(os.path.join("gfx", "grid.png"), sequence = True, width = 96, height = 96)
self.gfx['health'] = Game.load_image(os.path.join("gfx", "health.png"), sequence = True, width = 19, height = 18)
self.gfx['medium_particle'] = Game.load_image(os.path.join("gfx", "medium_particle.png"))
self.gfx['footstep1'] = Game.load_image(os.path.join("gfx", "footstep1.png"))
self.gfx['footstep2'] = Game.load_image(os.path.join("gfx", "footstep2.png"))
self.gfx['bump_particle'] = Game.load_image(os.path.join("gfx", "bump_particle.png"))
self.gfx['shot'] = Game.load_image(os.path.join("gfx", "shot.png"))
self.gfx['player_chunk'] = Game.load_image(os.path.join("gfx", "player_chunk.png"))
self.gfx['background'] = Game.load_image(os.path.join("gfx", "background.png"))
self.gfx['spawn_particle'] = Game.load_image(os.path.join("gfx", "spawn_particle.png"))
self.gfx['shot_particle'] = Game.load_image(os.path.join("gfx", "shot_particle.png"))
self.gfx['death_particle'] = Game.load_image(os.path.join("gfx", "death_particle.png"))
self.fnt['fps'] = Game.load_font(os.path.join("fnt", "nulshock.ttf"), size = 40)
self.fnt['timer'] = Game.load_font(os.path.join("fnt", "nulshock.ttf"), size = 40)
self.fnt['final_score'] = Game.load_font(os.path.join("fnt", "nulshock.ttf"), size = 60)
self.fnt['score_press_start'] = Game.load_font(os.path.join("fnt", "squared.ttf"), size = 40)
self.fnt['title_name'] = Game.load_font(os.path.join("fnt", "squared.ttf"), size = 110)
self.fnt['title_press_start'] = Game.load_font(os.path.join("fnt", "squared.ttf"), size = 40)
self.fnt['player_select_press_buttons'] = Game.load_font(os.path.join("fnt", "squared.ttf"), size = 40)
self.mus['title'] = Game.load_audio(os.path.join("music", "title.ogg"))
self.mus['level'] = Game.load_audio(os.path.join("music", "level.ogg"))
self.sfx['pressstart'] = Game.load_audio(os.path.join("sfx", "pressstart.wav"))
self.sfx['playerregister'] = Game.load_audio(os.path.join("sfx", "playerregister.wav"))
self.sfx['respawn'] = Game.load_audio(os.path.join("sfx", "respawn.wav"))
self.sfx['bounce'] = Game.load_audio(os.path.join("sfx", "bounce.wav"))
self.sfx['shoot'] = Game.load_audio(os.path.join("sfx", "shoot.wav"))
self.sfx['death'] = Game.load_audio(os.path.join("sfx", "death.wav"))
self.sfx['buildlevel'] = Game.load_audio(os.path.join("sfx", "buildlevel.wav"))
self.sfx['timewarning'] = Game.load_audio(os.path.join("sfx", "timewarning.wav"))
self.sfx['hurt'] = []
for i in range(1,8):
self.sfx['hurt'].append(Game.load_audio(os.path.join("sfx", "hurt" + str(i) + ".wav")))
示例2: execute
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import load_font [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
示例3: execute
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import load_font [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
示例4: load_media
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import load_font [as 别名]
def load_media(self):
self.I_MYRMIDON = Game.load_image(os.path.join("media", "word.png"))
self.F_BENCHMARK_NAME = Game.load_font(os.path.join("media", "comick_book_caps.ttf"), 30)
示例5: _load_media
# 需要导入模块: from myrmidon import Game [as 别名]
# 或者: from myrmidon.Game import load_font [as 别名]
def _load_media(self):
Application.F_MAIN = Game.load_font(os.path.join("media", "comick_book_caps.ttf"), 8)
Application.F_MID = Game.load_font(os.path.join("media", "comick_book_caps.ttf"), 16)
Application.F_BIG = Game.load_font(os.path.join("media", "comick_book_caps.ttf"), 32)
Application.G_WORD = Game.load_image(os.path.join("media", "word.png"))
Application.G_J = Game.load_image(os.path.join("media", "j.png"), sequence=True, width=32)