def display_species_info(self, screen, it, myrect): y = myrect.y myimg = pygwrap.render_text(pygwrap.BIGFONT, it.name, myrect.width, justify=0, color=(240, 240, 240)) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect) y += myrect.height msg = it.desc if msg: myimg = pygwrap.render_text(pygwrap.SMALLFONT, msg, myrect.width, justify=-1) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect) y += myrect.height + 6 msg = it.stat_desc() if msg: myimg = pygwrap.render_text(pygwrap.ITALICFONT, msg, myrect.width, justify=0) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect)
def display_item_info( screen, it, myrect ): """Use the screen to display "it" in myrect.""" y = myrect.y # pygwrap.draw_text( screen, pygwrap.BIGFONT, str( it ), pygame.Rect( myrect.x, y, myrect.width, pygwrap.BIGFONT.get_linesize() ), justify = 0, color=(240,240,240) ) # y += pygwrap.BIGFONT.get_linesize() myimg = pygwrap.render_text( pygwrap.BIGFONT, str( it ), myrect.width, justify=0, color=(240,240,240) ) myrect = myimg.get_rect( topleft = ( myrect.x, y ) ) screen.blit( myimg , myrect ) y += myrect.height myrect = pygame.Rect( myrect.x, y, myrect.width, pygwrap.SMALLFONT.get_linesize() ) if it.identified: pygwrap.draw_text( screen, pygwrap.SMALLFONT, str( it.cost() ) + " GP", myrect, justify = -1 ) else: pygwrap.draw_text( screen, pygwrap.SMALLFONT, "? GP", myrect, justify = -1 ) pygwrap.draw_text( screen, pygwrap.SMALLFONT, str( it.mass // 10 ) + "." + str( it.mass % 10 ) + "lbs", myrect, justify = 1 ) y += pygwrap.BIGFONT.get_linesize() msg = it.desc() if msg: myimg = pygwrap.render_text(pygwrap.SMALLFONT, msg, myrect.width, justify = -1 ) myrect = myimg.get_rect( topleft = ( myrect.x, y ) ) screen.blit( myimg , myrect ) y += myrect.height + 6 msg = it.stat_desc() if msg and it.identified: myimg = pygwrap.render_text(pygwrap.ITALICFONT, msg, myrect.width, justify = 0 ) myrect = myimg.get_rect( topleft = ( myrect.x, y ) ) screen.blit( myimg , myrect )
def display_item_info(screen, it, myrect): """Use the screen to display "it" in myrect.""" y = myrect.y # pygwrap.draw_text( screen, pygwrap.BIGFONT, str( it ), pygame.Rect( myrect.x, y, myrect.width, pygwrap.BIGFONT.get_linesize() ), justify = 0, color=(240,240,240) ) # y += pygwrap.BIGFONT.get_linesize() myimg = pygwrap.render_text(pygwrap.BIGFONT, str(it), myrect.width, justify=0, color=(240, 240, 240)) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect) y += myrect.height myrect = pygame.Rect(myrect.x, y, myrect.width, pygwrap.SMALLFONT.get_linesize()) if it.identified: pygwrap.draw_text(screen, pygwrap.SMALLFONT, str(it.cost()) + " GP", myrect, justify=-1) else: pygwrap.draw_text(screen, pygwrap.SMALLFONT, "? GP", myrect, justify=-1) pygwrap.draw_text(screen, pygwrap.SMALLFONT, str(it.mass // 10) + "." + str(it.mass % 10) + "lbs", myrect, justify=1) y += pygwrap.BIGFONT.get_linesize() msg = it.desc() if msg: myimg = pygwrap.render_text(pygwrap.SMALLFONT, msg, myrect.width, justify=-1) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect) y += myrect.height + 6 msg = it.stat_desc() if msg and it.identified: myimg = pygwrap.render_text(pygwrap.ITALICFONT, msg, myrect.width, justify=0) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect)
def display_spell_info(self, screen, it): """Use the screen to display "it" in myrect.""" y = self.rect.y pygwrap.draw_text( screen, pygwrap.BIGFONT, str(it), pygame.Rect(self.rect.x, y, self.rect.width, pygwrap.BIGFONT.get_linesize()), justify=0, color=(240, 240, 240), ) y += pygwrap.BIGFONT.get_linesize() myrect = pygame.Rect(self.rect.x, y, self.rect.width, 16) pygwrap.draw_text(screen, pygwrap.SMALLFONT, "MP: {0}".format(it.mp_cost()), myrect, justify=1) # Display the spell colors. Start by listing the colors. gemlist = list() for k, v in it.gems.iteritems(): gemlist += (k + 1,) * v for t in range(it.gems_needed()): if t < len(gemlist): sgcolor = gemlist[t] else: sgcolor = 0 self.spell_gem_sprite.render(screen, (self.rect.x + t * 9, y), sgcolor) y += pygwrap.BIGFONT.get_linesize() if it.desc: myimg = pygwrap.render_text(pygwrap.SMALLFONT, it.desc, myrect.width, justify=-1) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect)
def display_species_info( self, screen, it, myrect ): y = myrect.y myimg = pygwrap.render_text( pygwrap.BIGFONT, it.name, myrect.width, justify=0, color=(240,240,240) ) myrect = myimg.get_rect( topleft = ( myrect.x, y ) ) screen.blit( myimg , myrect ) y += myrect.height msg = it.desc if msg: myimg = pygwrap.render_text(pygwrap.SMALLFONT, msg, myrect.width, justify = -1 ) myrect = myimg.get_rect( topleft = ( myrect.x, y ) ) screen.blit( myimg , myrect ) y += myrect.height + 6 msg = it.stat_desc() if msg: myimg = pygwrap.render_text(pygwrap.ITALICFONT, msg, myrect.width, justify = 0 ) myrect = myimg.get_rect( topleft = ( myrect.x, y ) ) screen.blit( myimg , myrect )
def alert( self, txt ): mydest = pygame.Rect( self.screen.get_width() // 2 - 200, self.screen.get_height()//2 - 100, 400, 200 ) mytext = pygwrap.render_text( pygwrap.SMALLFONT, txt, 400 ) mydest = mytext.get_rect( center = (self.screen.get_width() // 2, self.screen.get_height()//2) ) while True: ev = pygame.event.wait() if ( ev.type == pygame.MOUSEBUTTONUP) or ( ev.type == pygame.QUIT ) or (ev.type == pygame.KEYDOWN): break elif ev.type == pygwrap.TIMEREVENT: self.view( self.screen ) pygwrap.default_border.render( self.screen, mydest ) self.screen.blit( mytext, mydest ) pygame.display.flip()
def alert( self, txt, use_grammar=True ): if use_grammar: txt = dialogue.personalize_text_for_narrator( self, txt ) mydest = pygame.Rect( self.screen.get_width() // 2 - 200, self.screen.get_height()//2 - 100, 400, 200 ) mytext = pygwrap.render_text( pygwrap.SMALLFONT, txt, 400 ) mydest = mytext.get_rect( center = (self.screen.get_width() // 2, self.screen.get_height()//2) ) while True: ev = pygame.event.wait() if ( ev.type == pygame.MOUSEBUTTONUP) or ( ev.type == pygame.QUIT ) or (ev.type == pygame.KEYDOWN): break elif ev.type == pygwrap.TIMEREVENT: self.view( self.screen ) pygwrap.default_border.render( self.screen, mydest ) self.screen.blit( mytext, mydest ) pygame.display.flip()
def monologue( self, txt, speaker=None, balloon=animobs.SpeakHello ): if not speaker: self.alert( txt ) else: mytext = pygwrap.render_text( pygwrap.SMALLFONT, txt, 400 ) mydest = mytext.get_rect( center = (self.screen.get_width() // 2, self.screen.get_height()//4) ) self.view.focus( self.screen, *speaker.pos ) self.view.anims[speaker.pos].append( balloon(delay=0) ) while True: ev = pygame.event.wait() if ( ev.type == pygame.MOUSEBUTTONUP) or ( ev.type == pygame.QUIT ) or (ev.type == pygame.KEYDOWN): break elif ev.type == pygwrap.TIMEREVENT: self.view( self.screen ) pygwrap.default_border.render( self.screen, mydest ) self.screen.blit( mytext, mydest ) pygame.display.flip() self.view.anims.clear()
def monologue( self, txt, speaker=None, balloon=animobs.SpeakHello ): if not speaker: self.alert( txt ) else: mytext = pygwrap.render_text( pygwrap.SMALLFONT, txt, 400 ) mydest = mytext.get_rect( center = (self.screen.get_width() // 2, self.screen.get_height()//4) ) self.view.focus( self.screen, *speaker.pos ) self.view.anims[speaker.pos].append( balloon(delay=0) ) while True: ev = pygame.event.wait() if ( ev.type == pygame.MOUSEBUTTONUP) or ( ev.type == pygame.QUIT ) or (ev.type == pygame.KEYDOWN): break elif ev.type == pygwrap.TIMEREVENT: self.view( self.screen ) pygwrap.default_border.render( self.screen, mydest ) self.screen.blit( mytext, mydest ) pygame.display.flip() self.view.anims.clear()
def display_spell_info(self, screen, it): """Use the screen to display "it" in myrect.""" y = self.rect.y pygwrap.draw_text(screen, pygwrap.BIGFONT, str(it), pygame.Rect(self.rect.x, y, self.rect.width, pygwrap.BIGFONT.get_linesize()), justify=0, color=(240, 240, 240)) y += pygwrap.BIGFONT.get_linesize() myrect = pygame.Rect(self.rect.x, y, self.rect.width, 16) pygwrap.draw_text(screen, pygwrap.SMALLFONT, "MP: {0}".format(it.mp_cost()), myrect, justify=1) # Display the spell colors. Start by listing the colors. gemlist = list() for k, v in it.gems.iteritems(): gemlist += (k + 1, ) * v for t in range(it.gems_needed()): if t < len(gemlist): sgcolor = gemlist[t] else: sgcolor = 0 self.spell_gem_sprite.render(screen, (self.rect.x + t * 9, y), sgcolor) y += pygwrap.BIGFONT.get_linesize() if it.desc: myimg = pygwrap.render_text(pygwrap.SMALLFONT, it.desc, myrect.width, justify=-1) myrect = myimg.get_rect(topleft=(myrect.x, y)) screen.blit(myimg, myrect)
def render(self): if self.border: self.border.render( self.menu.screen , self ) if self.menu.items[self.menu.selected_item].desc != None: img = pygwrap.render_text( MENUFONT , self.menu.items[self.menu.selected_item].desc , self.w, justify = self.justify ) self.menu.screen.blit( img , self )
def render(self): pygwrap.draw_border( self.menu.screen , self ) if self.menu.items[self.menu.selected_item].desc != None: img = pygwrap.render_text( MENUFONT , self.menu.items[self.menu.selected_item].desc , self.w ) self.menu.screen.blit( img , self )
def render(self): if self.border: self.border.render( self.menu.screen , self ) if self.menu.items[self.menu.selected_item].desc != None: img = pygwrap.render_text( MENUFONT , self.menu.items[self.menu.selected_item].desc , self.w, justify = self.justify ) self.menu.screen.blit( img , self )