changeset 86:39d3e21551ad

Added a font to the menu font.
author Rene Dudfield <renesd@gmail.com>
date Sun, 08 Jul 2012 14:27:32 +0200
parents 5f4c71bedf21
children d0b93b886f40
files README.rst zrpn/client.py zrpn/display.py zrpn/main.py zrpn/sgc/widgets/_locals.py
diffstat 5 files changed, 44 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/README.rst	Sun Jul 08 14:15:47 2012 +0200
+++ b/README.rst	Sun Jul 08 14:27:32 2012 +0200
@@ -179,13 +179,11 @@
 Sounds
 ------
 
-* http://www.freesound.org/people/deathnsorrow/sounds/149177/
-* http://www.freesound.org/people/audione/sounds/52458/
-* http://www.freesound.org/people/HardPCM/sounds/32954/
-* http://www.freesound.org/people/Robinhood76/sounds/66134/
 
 Fonts
 -----
 
 * http://www.fontsquirrel.com/fonts/Pincoyablack
-* http://www.fontsquirrel.com/fonts/GoodDog
\ No newline at end of file
+* http://www.fontsquirrel.com/fonts/GoodDog
+
+
--- a/zrpn/client.py	Sun Jul 08 14:15:47 2012 +0200
+++ b/zrpn/client.py	Sun Jul 08 14:27:32 2012 +0200
@@ -11,17 +11,27 @@
 
 import display
 import packets
+from skelutil import data_dir
 
 
 class Client(object):
     def __init__(self, address, port):
         self.display = display.Display()
+
+
+
+        self.shotgun = pygame.mixer.Sound(data_dir("shotgun.wav"))
+        self.shotgun_reload = pygame.mixer.Sound(data_dir("shotgun-reload.wav"))
+        
         self.connected = False
         self.client = net.Client()
         self.connection = self.client.connect(address, port)
-        self.lbl_time = sgc.Label(pos=(0, 0), text="time\nwasted=\n0")
-        self.lbl_score = sgc.Label(pos=(0, 70), text="score=\n0")
-        self.lbl_highscore = sgc.Label(pos=(0, 120), text="First=\n0")
+
+        self.font = data_dir("GoodDog.otf")
+
+        self.lbl_time = sgc.Label(pos=(0, 0), text="time\nwasted=\n0", font=self.font)
+        self.lbl_score = sgc.Label(pos=(0, 70), text="score=\n0", font=self.font)
+        self.lbl_highscore = sgc.Label(pos=(0, 120), text="First=\n0", font=self.font)
 
         w = [self.lbl_time, self.lbl_score, self.lbl_highscore]
 
@@ -38,6 +48,10 @@
                 elif event.type == pygame.MOUSEBUTTONDOWN:
                     x, y = event.pos[0] // 24, event.pos[1] // 24
                     self.connection.net_click(x, y)
+
+
+
+
                 elif event.type == net.event.NETWORK:
                     if event.net_type == net.event.NET_RECEIVED:
                         if event.p_type == packets.INIT:
@@ -45,6 +59,11 @@
                                     event.packet.sprites)
                         elif event.p_type == packets.ANIMATIONS:
                             self.display.do_animations(event.packet.animations)
+
+
+                            
+
+
                         elif event.p_type == packets.SCORE:
                             self.lbl_score.config(text="score=\n" + str(event.packet.score_num))
                             self.lbl_highscore.config(text="first=\n" + str(event.packet.highscore))
--- a/zrpn/display.py	Sun Jul 08 14:15:47 2012 +0200
+++ b/zrpn/display.py	Sun Jul 08 14:27:32 2012 +0200
@@ -7,12 +7,19 @@
 
 import sprites
 
-
+from skelutil import data_dir
 
 class Display(object):
     def __init__(self):
-        pygame.display.init()
+        #pygame.display.init()
+        #pygame.mixer.init()
+        pygame.init()
         pygame.font.init()
+
+        self.shotgun = pygame.mixer.Sound(data_dir("shotgun.wav"))
+        self.shotgun_reload = pygame.mixer.Sound(data_dir("shotgun-reload.wav"))
+    
+
         self.screen = sgc.surface.Screen((800, 600))
         self.screen.fill((0x33, 0x33, 0x33))
         self.background = self.screen.copy()
@@ -39,6 +46,10 @@
             else:
                 if kind == 'die':
                     sprite.die(turn)
+
+                    #self.shotgun.play()
+                    self.shotgun_reload.play()
+
                 elif kind == 'fall':
                     sprite.fall(turn)
 
--- a/zrpn/main.py	Sun Jul 08 14:15:47 2012 +0200
+++ b/zrpn/main.py	Sun Jul 08 14:27:32 2012 +0200
@@ -11,7 +11,7 @@
 import display
 import client
 import logging
-
+from skelutil import data_dir
 
 
 
@@ -58,8 +58,11 @@
 
 
 def main():
+
+    
     screen = display.Display()
 
+    sgc.Font.set_fonts({"title": data_dir("pincoyablack.otf")}, size=60)
 
     default_host = "zrpn.pygame.org"
     default_host = "localhost"
--- a/zrpn/sgc/widgets/_locals.py	Sun Jul 08 14:15:47 2012 +0200
+++ b/zrpn/sgc/widgets/_locals.py	Sun Jul 08 14:27:32 2012 +0200
@@ -239,7 +239,7 @@
     col = (255,255,255)
 
     @classmethod
-    def set_fonts(cls, fonts={}):
+    def set_fonts(cls, fonts={}, size=16):
         """
         Set fonts to a specific font. If a font exists, it will be replaced,
         otherwise it will be newly created.
@@ -253,7 +253,7 @@
         for font in fonts:
             if font not in cls._fonts:
                 cls._fonts[font] = _Font()
-            cls._fonts[font].replace(cls._create_font(fonts[font], 16))
+            cls._fonts[font].replace(cls._create_font(fonts[font], size))
 
         if not cls._fonts["widget"]:
             cls._fonts["widget"].replace(cls._create_font("Arial", 16))