def draw(self): #TODO: text.drawTextCenter(text, font, surf, pos, color) mytext = text.createText(self.char, self.font, self.color) outline = text.createText(self.char, self.font, shared.OUTLINECOLOR) r = mytext.get_rect() r.center = self.center x,y = r.x, r.y shared.windowSurface.blit(outline, (x-1,y-1)) shared.windowSurface.blit(outline, (x-1,y+1)) shared.windowSurface.blit(outline, (x+1,y-1)) shared.windowSurface.blit(outline, (x+1,y+1)) shared.windowSurface.blit(mytext, (x,y))
def __init__(self, steps, char): super(LetterEffectInstance, self).__init__(steps) self.char = char self.base_size = random.randint(100, 200) # FIXME: improve formula to determine max 'left' value self.color = random.choice(shared.NICECOLORS) base_surface = text.createText(self.char, shared.font_cache[int(self.base_size)]) base_rect = base_surface.get_rect() w,h = base_rect.width, base_rect.height self.center = random.randint(w/2, shared.WINDOWWIDTH - w/2), random.randint(h/2, shared.WINDOWHEIGHT - h/2)