def paint(self,screen): self.screen = screen self.orig = pygame.Surface((screen.get_width(),screen.get_height())) self.orig.blit(screen,(0,0)) c = (255,255,255) text.writec(screen,self.game.font_medium,c,self.text,border=2) pygame.display.flip()
def paint(self,screen): if self.game.audio and self.text == 'Pause': #HACK, bleckl! pygame.mixer.music.pause() self.screen = screen self.orig = pygame.Surface((screen.get_width(),screen.get_height())) self.orig.blit(screen,(0,0)) c = (255,255,255) text.writec(screen,self.game.font_medium,c,self.text,border=2) bg = (0,0,0) if len(self.sub) > 40: for dx,dy in [(-1,0),(1,0),(0,1),(0,-1),(2,2)]: text.writewrap(screen,self.game.font_small,pygame.Rect(40+dx,270+dy,560,1),bg,self.sub) text.writewrap(screen,self.game.font_small,pygame.Rect(40,270,560,1),c,self.sub) else: img = self.game.font_small2.render(self.sub,1,bg) for dx,dy in [(-1,0),(1,0),(0,1),(0,-1),(2,2)]: screen.blit(img,((screen.get_width()-img.get_width())/2+dx,270+dy)) img = self.game.font_small2.render(self.sub,1,c) screen.blit(img,((screen.get_width()-img.get_width())/2,270)) pygame.display.flip()
def paint(self,screen): self.screen = screen self.orig = pygame.Surface((screen.get_width(),screen.get_height())) self.orig.blit(screen,(0,0)) screen.fill((0,0,0)) self.orig.set_alpha(128) screen.blit(self.orig,(0,0)) self.orig.set_alpha(255) c = (255,255,255) text.writec(screen,self.game.font_menu,c,self.text,border=2) bg = (0,0,0) if len(self.sub) > 40: for dx,dy in [(-1,0),(1,0),(0,1),(0,-1),(2,2)]: text.writewrap(screen,self.game.font_small,pygame.Rect(40+dx,270+dy,560,1),bg,self.sub) text.writewrap(screen,self.game.font_small,pygame.Rect(40,270,560,1),c,self.sub) else: img = self.game.font_small2.render(self.sub,1,bg) for dx,dy in [(-1,0),(1,0),(0,1),(0,-1),(2,2)]: screen.blit(img,((screen.get_width()-img.get_width())/2+dx,270+dy)) img = self.game.font_small2.render(self.sub,1,c) screen.blit(img,((screen.get_width()-img.get_width())/2,270)) pygame.display.flip()
from pgu import text pygame.font.init() screen = pygame.display.set_mode((640,480),SWSURFACE) fg = (0,0,0) bg = (0,192,255) screen.fill(bg) bg = (255,255,255) font = pygame.font.SysFont("default", 24) ##:: text.write(screen,font,(0,0),bg,"Hello World!") text.writec(screen,font,bg,"Centered Text") text.writepre(screen,font,pygame.Rect(160,48,320,100),fg,"""This is some preformatted t e x t""") text.writewrap(screen,font,pygame.Rect(160,268,320,100),fg,"""This is some text that will wrap automatically. This is some text that will wrap automatically. This is some text that will wrap automatically. This is some text that will wrap automatically.""") ## pygame.display.flip() _quit = 0 while not _quit: for e in pygame.event.get(): if e.type is QUIT: _quit = 1 pygame.time.wait(10)
from pgu import text pygame.font.init() screen = pygame.display.set_mode((640, 480), SWSURFACE) fg = (0, 0, 0) bg = (0, 192, 255) screen.fill(bg) bg = (255, 255, 255) font = pygame.font.SysFont("default", 24) ##:: text.write(screen, font, (0, 0), bg, "Hello World!") text.writec(screen, font, bg, "Centered Text") text.writepre(screen, font, pygame.Rect(160, 48, 320, 100), fg, """This is some preformatted t e x t""") text.writewrap( screen, font, pygame.Rect(160, 268, 320, 100), fg, """This is some text that will wrap automatically. This is some text that will wrap automatically. This is some text that will wrap automatically. This is some text that will wrap automatically.""" ) ## pygame.display.flip() _quit = 0 while not _quit: