changeset 37:0734bcee6c19

music
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sat, 16 Mar 2013 10:01:54 +0100
parents 974a92aeedf9
children 2f0026bdc043
files fhrl/__main__.py fhrl/blabla.ogg fhrl/resources.py
diffstat 3 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/fhrl/__main__.py	Sat Mar 16 09:48:44 2013 +0100
+++ b/fhrl/__main__.py	Sat Mar 16 10:01:54 2013 +0100
@@ -29,6 +29,7 @@
         pygame.display.flip()
 
     def run(self):
+        self.display.resources.music.play(loops=-1)
         self.pause(self.display.resources.title)
         hero = Hero()
         for level in xrange(6):
@@ -74,5 +75,6 @@
             self.pause(self.display.resources.over)
 
 pygame.display.init()
+pygame.mixer.init()
 Game().run()
 
Binary file fhrl/blabla.ogg has changed
--- a/fhrl/resources.py	Sat Mar 16 09:48:44 2013 +0100
+++ b/fhrl/resources.py	Sat Mar 16 10:01:54 2013 +0100
@@ -18,6 +18,12 @@
         self.title = self.load_image('title.png')
         self.over = self.load_image('over.png')
         self.won = self.load_image('won.png')
+        self.music = self.load_sound('blabla.ogg')
+
+    @staticmethod
+    def load_sound(filename):
+        f = StringIO.StringIO(pkgutil.get_data('fhrl', filename))
+        return pygame.mixer.Sound(f)
 
     @staticmethod
     def load_image(filename):