コード例 #1
0
ファイル: FrameRateViewer.py プロジェクト: huvermann/LearnGit
 def drawTextLabel(self, x, y, text, font=FontProvider.defaultFont(), color=(0,0,0)):
     label = font.render(text, 1, color)
     textPos = label.get_rect()
     textPos.left = x
     textPos.top = y
     self._screen.blit(label, textPos)
     return textPos
コード例 #2
0
 def render(self, width=None):
     font = FontProvider.getFontByFileName(self._fontProperties)
     fontImage = font.render(self.text, True, self._fontProperties.Color, self._fontProperties.Background)
     if not width:
         return fontImage
     else:
         rect = fontImage.get_rect()
         self.image = pygame.Surface((width, rect.height))
     
         if self._fontProperties.Background:
             self.image.fill(self._fontProperties.Background)
         else:
             self.image.fill((1,2,3))
             self.image.set_colorkey((1,2,3))
         center = width // 2 - rect.width // 2
         self.image.blit(fontImage, (center, 0))
         return self.image