def activate(self): xsize = 300 ysize = 70 bkg = Surface((xsize, ysize)) bkg.lock() bkg.fill((128,128,128)) for i in range(1, 4): draw.rect(bkg,(i*32,i*32,i*32),(4-i,4-i,xsize+(i-4)*2,ysize+(i-4)*2),3) corner = (64,64,64) bkg.set_at((0,0), corner) bkg.set_at((xsize,0), corner) bkg.set_at((xsize,ysize), corner) bkg.set_at((0,ysize), corner) bkg.unlock() bkg.set_alpha(64) self.bkg = bkg if self.title != None: banner = OutlineTextBanner(self.title, (200,200,200), 20) self.title_image = banner.render() self.title_image.set_alpha(96) self.arrow = res.loadImage("wait_arrow.png", colorkey=1)
def draw(self, surface): if self.blank: self.blank = False sw, sh = surface.get_size() fontSize = int(0.0667 * sh) # draw the border x, y = 0.0313 * sw, 0.6667 * sh w, h = 0.9375 * sw, 0.2917 * sh self.border.draw(surface, (x, y, w, h)) fullpath = res.fontPath("dpcomic.ttf") font = pygame.font.Font(fullpath, fontSize) # adjust the margins of text if there is a title if self.title: x = 0.0625 * sw y = 0.7 * sh gui.drawText(surface, self.text, (0,0,0), (x+10,y+8,w-18,h-12), font, aa=1, bkg=self.border.background) # print the title if self.title != None: banner = OutlineTextBanner(self.title, (200,200,200), int(fontSize*1.25), font=self.font) title_image = banner.render() x, y = 0.4688 * sw, 0.625 * sh surface.blit(title_image, (x, y)) # show arrow #x, y = 0.0625 * sw, 0.9167 * sh #arrow = res.loadImage("wait_arrow.png", colorkey=1) #surface.blit(arrow, (x, y)) # play a nice sound self.wait_sound.stop() self.wait_sound.play()