# Game Game Over Banner import os import pygame import pygame.font from pygame.locals import * import game, gfx # text-related constants from text import * def load_game_resources(): pass class TextMessage: """Render a text message to surface and background; set object's rect coordinates before drawing if you want to move it.""" def __init__(self,surface,background,text,fontsize=70,fontcolor=WHITE,fontpath=BABELFISH_FONTPATH): font = pygame.font.Font(fontpath, fontsize) # for some reason Babelfish wraps a little when starting at the first position fixed_text = ' ' + text self.image, self.rect = gfx.text(font, fontcolor, fixed_text) self.lastrect = self.rect self.rect.centerx = gfx.rect.centerx self.rect.centery = gfx.rect.centery - 50 self.dead = 0 self.item = 0 self.surface = surface self.background = background def erase(self): # erase old menu self.surface.fill(0,self.rect) gfx.dirty(self.rect) self.background.fill(0,self.rect) def draw(self): r = self.surface.blit(self.image,self.rect) gfx.dirty(r) #gfx.dirty2(r, self.lastrect) #self.lastrect = r self.background.blit(self.image,self.rect) def tick(self, speedadjust = 1.0): pass