projects
/
naja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix gamestate setup.
[naja.git]
/
naja
/
widgets
/
text.py
diff --git
a/naja/widgets/text.py
b/naja/widgets/text.py
index 239e10a621b2a74bf9af8a1ad2320582a9308a09..53030c55b8ad730c4a7725f07dc1bf9c5dcf1f52 100644
(file)
--- a/
naja/widgets/text.py
+++ b/
naja/widgets/text.py
@@
-1,6
+1,9
@@
+import pygame
+
from naja.constants import FONT, FONT_SIZE
from naja.widgets.base import Widget
from naja.resources import resources
from naja.constants import FONT, FONT_SIZE
from naja.widgets.base import Widget
from naja.resources import resources
+from naja.utils import convert_colour
class TextWidget(Widget):
class TextWidget(Widget):
@@
-10,14
+13,16
@@
class TextWidget(Widget):
self.text = text
self.fontname = fontname or FONT
self.text = text
self.fontname = fontname or FONT
- self.fontsize =
fontsize or FONT_SIZE
- self.colour = co
lour or (0, 0, 0
)
+ self.fontsize =
(fontsize or FONT_SIZE) / 2
+ self.colour = co
nvert_colour(colour or (0, 0, 0)
)
- def
_
prepare(self):
+ def prepare(self):
self.font = resources.get_font(self.fontname, self.fontsize)
self.font = resources.get_font(self.fontname, self.fontsize)
- self.surface = self.font.render(self.text, True, self.colour)
+ text = self.font.render(self.text, True, self.colour)
+ text_rect = text.get_rect()
+ self.surface = pygame.transform.scale(text, (text_rect.width * 2,
+ text_rect.height * 2))
self.size = self.surface.get_rect().size
def draw(self, surface):
self.size = self.surface.get_rect().size
def draw(self, surface):
- self.prepare()
surface.blit(self.surface, self.rect)
surface.blit(self.surface, self.rect)