def render_spell_card(self, surface, spell): """ render a spell card on the screen """ position = (0, 0) icon = spell.icon surface.blit(icon, position) rect = icon.get_rect() text = TextBanner(spell.description, (255, 255, 255), size=14) text.render() position = (rect.width + 8, rect.height - text.rect.height) surface.blit(text.image, position)
def __init__(self, text, pos, color=(255, 255, 255), icon=None): banner = TextBanner(text, color, 12) if icon == None: self.image = banner.image else: icon = pygame.transform.scale(icon, (32, 32)) r = banner.image.get_rect() r.width += 32 r.height = 32 self.image = Surface(r.size) self.image.set_colorkey((0, 0, 0)) self.image.blit(icon, (0, 0)) self.image.blit(banner.image, (32, 0)) self.rect = self.image.get_rect() self.rect.topleft = pos self.y = float(pos[1]) self.time = 0 self.alive = 1
def draw(self, surface): if blank: surface.fill((0, 0, 0)) msg = TextBanner("Please wait...", (128, 128, 128), size=18) surface.blit(msg.render(alpha=True), (200, 210)) self.blank = False