Exemple #1
0
    def draw(self, surface):
        # fade in the dialog box background
        if self.state == 0:
            surface.blit(self.bkg, (10,160))
            self.counter += 1
            if self.counter == 6:
                self.bkg.set_alpha(0)
                self.bkg = self.bkg.convert()
            elif self.counter == 7:
                surface.fill((128,128,128), (14, 146, self.bkg.get_size()))
                print "fill"
                self.counter = 0
                self.state = 1
                self.bkg = None

        # fade in the title, if any
        elif self.state == 1:
            if self.title != None:
                surface.blit(self.title_image, (15,150))
                self.counter += 1
                if self.counter == 3:
                    self.state = 2
                    self.counter = 0
                    self.title_image = None
            else:
                self.state = 2

        # quickly write the text
        elif self.state == 2:
            x = 20

            if self.title != None:
                y = 168
            else:
                y = 167

            for line in wrap(self.text, self.wrap_width):
                banner = TextBanner(line, size=self.text_size)
                surface.blit(banner.render(self.background), (x,y))
                y += banner.font.size(line)[1]

            self.menu = cMenu(Rect((25,210),(280, 30)),
                5, 5, 'horizontal', 10,
                [('Yes', self.yes),
                ('No', self.no)],
                font="fonts/dpcomic.ttf", font_size=16)

            self.menu.ready()
            self.wait_sound.stop()
            self.wait_sound.play()
            self.state = 3

        elif self.state == 3:
            self.menu.draw(surface)
Exemple #2
0
 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)
Exemple #3
0
    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)
Exemple #4
0
    def draw(self, surface):
        if len(self.maps) == 0:
            surface.fill((0,0,0))
            msg = TextBanner("Please wait...", (128, 128, 128), size=10)
            surface.blit(msg.render(alpha=True), (140,140))
            return

        for i in self.maps:
            if i[4] > 0:
                s = i[5].at(i[0], i[1])
                m = i[4] / self.map_fadeout
                s.set_alpha(255 - (m * 255))

            else:
                s = i[5].at(i[0], i[1])
            
            pos = i[0], i[1]
            surface.blit(s, pos)

        self.menu.draw(surface)
Exemple #5
0
    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
Exemple #6
0
 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
Exemple #7
0
 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