comparison pytouhou/ui/gamerunner.pyx @ 528:7c3c90468996

Inherit music players from a base class.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 18 Dec 2013 22:36:23 +0100
parents 2e8ceaa85d5c
children 1abb6f7db8cc
comparison
equal deleted inserted replaced
527:db28538cd399 528:7c3c90468996
15 cimport cython 15 cimport cython
16 16
17 from pytouhou.lib cimport sdl 17 from pytouhou.lib cimport sdl
18 18
19 from .window cimport Window, Runner 19 from .window cimport Window, Runner
20 from .music import MusicPlayer, SFXPlayer, NullPlayer 20 from .music import BGMPlayer, SFXPlayer
21 from pytouhou.game.game cimport Game 21 from pytouhou.game.game cimport Game
22 from pytouhou.game.music cimport MusicPlayer
22 23
23 24
24 cdef class GameRunner(Runner): 25 cdef class GameRunner(Runner):
25 cdef object background, con, resource_loader, keys, replay_level, common 26 cdef object background, con, resource_loader, keys, replay_level, common
26 cdef Game game 27 cdef Game game
63 game.players[0].bombs = self.replay_level.bombs 64 game.players[0].bombs = self.replay_level.bombs
64 game.difficulty = self.replay_level.difficulty 65 game.difficulty = self.replay_level.difficulty
65 66
66 self.save_keystates = save_keystates 67 self.save_keystates = save_keystates
67 68
68 null_player = NullPlayer() 69 null_player = MusicPlayer()
69 if bgms is not None: 70 if bgms is not None:
70 game.music = MusicPlayer(self.resource_loader, bgms) 71 game.music = BGMPlayer(self.resource_loader, bgms)
71 game.music.play(0) 72 game.music.play(0)
72 else: 73 else:
73 game.music = null_player 74 game.music = null_player
74 75
75 game.sfx_player = SFXPlayer(self.resource_loader) if not self.skip else null_player 76 game.sfx_player = SFXPlayer(self.resource_loader) if not self.skip else null_player