changeset 44:d38202b86243

nicer fonts
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Wed, 24 Aug 2011 21:05:16 +0200
parents 84989d4aba4e
children 2d245bfba8b5
files effect.py main.py menu.py pf_ronda_seven_bold.ttf
diffstat 4 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/effect.py	Tue Aug 23 22:08:13 2011 +0200
+++ b/effect.py	Wed Aug 24 21:05:16 2011 +0200
@@ -3,7 +3,12 @@
 
 import pygame
 
-def outlined_text(font, text, color, border_color):
+
+def get_font():
+    return pygame.font.Font('pf_ronda_seven_bold.ttf', 8)
+
+def outlined_text(text, color, border_color):
+    font = get_font()
     notcolor = [c^0xFF for c in border_color]
     base = font.render(text, 0, border_color, notcolor)
     size = base.get_width() + 2, base.get_height() + 2
@@ -23,11 +28,10 @@
 class CaptionSprite(pygame.sprite.Sprite):
     def __init__(self, x, y, text, color, delay, ttl):
         super(CaptionSprite, self).__init__()
-        font = pygame.font.Font(None, 18)
         self.text = text
         self.color = color
         bgcolor = (32, 32, 32)
-        self.image = outlined_text(font, text, color, bgcolor)
+        self.image = outlined_text(text, color, bgcolor)
         self.rect = self.image.get_rect()
         self.x = x
         self.y = y
--- a/main.py	Tue Aug 23 22:08:13 2011 +0200
+++ b/main.py	Wed Aug 24 21:05:16 2011 +0200
@@ -66,7 +66,7 @@
     def main(self):
         try:
             while True:
-                self.display.tick(tick=20)
+                self.display.tick(tick=30)
                 self.control()
                 self.display.scroll_after(self.hero.sprite.rect)
         except display.GameQuit:
--- a/menu.py	Tue Aug 23 22:08:13 2011 +0200
+++ b/menu.py	Wed Aug 24 21:05:16 2011 +0200
@@ -8,11 +8,10 @@
 class GameInfo(pygame.sprite.Sprite):
     def __init__(self, x, y, text, color):
         super(GameInfo, self).__init__()
-        self.font = pygame.font.Font(None, 16)
         self.x, self.y = x, y
         self.text = text
         self.color = color
-        self.image = effect.outlined_text(self.font, text, color, (32, 32, 32))
+        self.image = effect.outlined_text(text, color, (32, 32, 32))
         self.rect = self.image.get_rect()
         self.rect.center = self.x, self.y
 
@@ -21,7 +20,6 @@
             self.text = text
         if color is not None:
             self.color = color
-        self.image = effect.outlined_text(self.font, self.text, self.color,
-                                          (32, 32, 32))
+        self.image = effect.outlined_text(self.text, self.color, (32, 32, 32))
         self.rect = self.image.get_rect()
         self.rect.center = self.x, self.y
Binary file pf_ronda_seven_bold.ttf has changed