当前位置: 首页>>代码示例>>Python>>正文


Python textrect.render_textrect函数代码示例

本文整理汇总了Python中textrect.render_textrect函数的典型用法代码示例。如果您正苦于以下问题:Python render_textrect函数的具体用法?Python render_textrect怎么用?Python render_textrect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了render_textrect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pageMessageSingleView

def pageMessageSingleView(message, page_nr):
    global buttons
    initButtons(pageMessageSingleView)
    
    print "MessageSingleView:", message

    buttons[pageMessageSingleView][1].np_value= {'page_nr': page_nr}    #allow go back to correct page

    msg_surface= pygame.Surface((300,198), pygame.SRCALPHA)
    msg_surface.convert_alpha()
    
    msg_surface.fill((255,255,255))
    msg_surface.fill((0,0,0), pygame.Rect(1,1,298, 196))

    txtFont = pygame.font.SysFont("opensans", 16)
    txtRect= pygame.Rect(10, 6, 280, 184)

    try:
        rendered_text = render_textrect(message['content'], txtFont, txtRect, (255, 255, 255), (0, 0, 0), 0)
    except TextRectException:
        print 'MessageSingleView: text to long'
        rendered_text = render_textrect("Error:\nCouldn't render text, doesn't fit", txtFont, txtRect, (255, 255, 255), (0, 0, 0), 0)

    msg_surface.blit(rendered_text, txtRect.topleft)
    screen.blit(msg_surface, (10,10))
    pygame.display.update()

    buttons[pageMessageSingleView].append(pisms_ui.Button((148, 218, 24, 22), bg='btn_trash', np=pageDeleteMessage,
        np_value={'message': message, 'page_nr': page_nr}))
开发者ID:ByteFex,项目名称:PGPager,代码行数:29,代码来源:pisms.py

示例2: changeVal

    def changeVal(self, val=None):
        if not val is None:
            self.val = val
        self.panel = pygame.Surface(self.rect.size)
        self.panel.blit(self.backPanel, (0, 0))

        font = CHARACTER_SELECTION_FONT
        textHeight = font.get_linesize() + 2
        tempRect = Rect((0, 0), (self.rect.width, textHeight))

        text = textrect.render_textrect(
            self.name, font, tempRect, CHARACTER_SELECTION_FONT_COLOR, ALMOST_BLACK, 0, True
        )
        tempRect = Rect((0, 0), text.get_size())
        tempRect.top = (CHARACTER_SELECT_PANEL_SIZE[1] / 2) - (tempRect.height / 2)
        loc = (tempRect.left + CHARACTER_SELECT_PANEL_BORDER_WIDTH + CHARACTER_SELECT_PANEL_BORDER_SIZE, tempRect.top)
        self.panel.blit(text, loc)

        if self.ready:
            msg = "READY"
            color = CHARACTER_SELECTION_READY_COLOR
        else:
            msg = str(self.val) + "/" + str(self.maxVal)
            color = CHARACTER_SELECTION_FONT_COLOR
        text = textrect.render_textrect(msg, font, tempRect, color, ALMOST_BLACK, 2, True)
        loc = (tempRect.left - CHARACTER_SELECT_PANEL_BORDER_WIDTH - CHARACTER_SELECT_PANEL_BORDER_SIZE, tempRect.top)
        self.panel.blit(text, loc)
开发者ID:Wopple,项目名称:fimbulvetr,代码行数:27,代码来源:characterSelect_m.py

示例3: updateStructureCount

 def updateStructureCount(self, fortressCount, spireCount, altarCount):
     self.fortressCount = fortressCount
     self.spireCount = spireCount
     self.altarCount = altarCount
     
     self.structureCountPanel = pygame.Surface(self.structureCountPanelRect.size)
     self.structureCountPanel.fill(UNIT_HUD_COLORS[self.team])
     
     self.structureCountPanel.blit(self.fortressIcon, self.fortressIconRect.topleft)
     self.structureCountPanel.blit(self.spireIcon, self.spireIconRect.topleft)
     self.structureCountPanel.blit(self.altarIcon, self.altarIconRect.topleft)
     
     textRect = Rect((0,0), (100, STRUCTURE_COUNT_FONT.get_height() + 4))
     
     textSurface = textrect.render_textrect(" x" + str(self.fortressCount), STRUCTURE_COUNT_FONT, textRect,
                                            ALMOST_BLACK, BLACK, 0, True)
     textRect.bottomleft = self.fortressIconRect.bottomright
     self.structureCountPanel.blit(textSurface, textRect.topleft)
     
     
     textSurface = textrect.render_textrect(" x" + str(self.spireCount), STRUCTURE_COUNT_FONT, textRect,
                                            ALMOST_BLACK, BLACK, 0, True)
     textRect.left = self.spireIconRect.right - 3
     self.structureCountPanel.blit(textSurface, textRect.topleft)
     
     textSurface = textrect.render_textrect(" x" + str(self.altarCount), STRUCTURE_COUNT_FONT, textRect,
                                            ALMOST_BLACK, BLACK, 0, True)
     textRect.left = self.altarIconRect.right - 3
     self.structureCountPanel.blit(textSurface, textRect.topleft)
开发者ID:Wopple,项目名称:fimbulvetr,代码行数:29,代码来源:unithud.py

示例4: draw

 def draw(self, surf):
     if self.view == VIEW_MAINMENU:
         surf.fill(COL_MENUBG)
         for button in self.mainmenu_buttons:
             col = COL_BPLAY #Default
             text = button
             if button == "play":
                 col = COL_BPLAY
                 text = "Play!"
             elif button == "reset":
                 col = COL_BRESET
                 text = "Reset\nProgress"
             elif button == "quit":
                 col = COL_BQUIT
                 text = "Quit Game"
             
             pygame.draw.rect(surf,col,self.mainmenu_buttons[button])
             pygame.draw.rect(surf,(255,255,255),self.mainmenu_buttons[button].inflate(3,3),3)
             pygame.draw.rect(surf,(255,255,255),self.mainmenu_buttons[button].inflate(-8,-8),1)
             
             tsurf = render_textrect(text,self.menufont,self.mainmenu_buttons[button].inflate(-10,-10), COL_BTEXT, (0,0,0,0),1)
             surf.blit(tsurf,self.mainmenu_buttons[button])
         
         
         prog = self.menufont.render("Progress: %d out of %d levels"%(len(self.completedlevels),len(self.alllevels)),1,COL_TEXT)
         surf.blit(prog,(50,650))
         
         surf.blit(self.rendered_cache['titletopper'],(0,0))
         
         xoffset = 576/2 - sum([i.get_width() for i in self.rendered_cache['title']])/2
         for i,s in enumerate(self.rendered_cache['title']):
             surf.blit(s,(xoffset,150+(i*40)))
             xoffset += s.get_width()
         
     
     elif self.view == VIEW_END:
         surf.fill(COL_MENUBG)
         tsurf = render_textrect("You won!\nProgress has been reset.\nPress any key to continue back to the main menu.",self.menufont,surf.get_rect().inflate(-100,-100), COL_BTEXT, (0,0,0,0),1)
         surf.blit(tsurf,surf.get_rect())
         
     elif self.view == VIEW_GAME:
         gm = self.gm
         surf.fill(COL_BG)
         gm.draw()
         surf.blit(gm.surf,(0,0))
 
         for i,line in enumerate(gm.text):
             yoffset = i*self.mainfont.get_height()
             surf.blit(self.mainfont.render(line, 0, COL_TEXT),(10,590+yoffset))
 
         if gm.curworld.maxhistory != -1:
             hourleft = gm.curworld.maxhistory-gm.curworld.ticks%gm.curworld.maxhistory -1
             surf.blit(self.dayfont.render("Hours Left: %d"%hourleft,1,COL_TEXT),(10,10))
         if gm.curworld.maxlives > 0:
             livesleft = gm.curworld.maxlives - gm.curplr.generation-1
             surf.blit(self.rendered_cache['livesleft'],(10,25))
             x = 10+self.rendered_cache['livesleft'].get_width()
             y = 25+ self.dayfont.get_ascent()/2 + 6
             for i in xrange(livesleft):
                 pygame.draw.circle(surf,COL_PLAYER,(x+(i*13),y),6)
开发者ID:adahera222,项目名称:LD28-OneDay,代码行数:60,代码来源:gameClasses.py

示例5: showBookDetails

    def showBookDetails(self, screen, options):
        self.bookNumber = self.index
        print "index", self.index
        book = self.bookshelf[self.bookNumber]
        
        self.font = pygame.font.SysFont('Arial', 15)
        
        rendered_title = tx.render_textrect("\'" + book.title + "\' by \'" + book.author +"\'", self.font, Rect(20, 200, 400, 400), (255, 255, 255), (48, 48, 48), 0)
        screen.blit(rendered_title, options.lowerHalfScreenrect.topleft)
        
        file = open(options.bookshelfPath +'/' + book.filepath + '/' + "text.txt", 'r')
        content = file.read()

        (timeToRead, numWords, self.summary) = Summarize.main(content, 10, needSummary=True)
        book.timeToRead = round(timeToRead,2)
        self.summary = self.summary[:650] + "..."
        print "*summary*", self.summary, " : ", "*timeToRead*", book.timeToRead
        
        screen.blit(self.font.render("Total time : " + str(book.timeToRead) + " min", True, (250,150,150)), (0, 220))
        
        rendered_sumtitle = tx.render_textrect("Summary (There were " + str(numWords) + " words in actual document)", self.font, Rect(20, 240, 400, 400), (48, 48, 48), (200, 200, 200), 0)
        screen.blit(rendered_sumtitle, (0, 240))
        
        rendered_summary = tx.render_textrect(self.summary, self.font, options.summary, (60, 60, 60), (230, 230, 230), 0)
        
        if rendered_summary:
            screen.blit(rendered_summary, options.summary.topleft)

        #screen.blit(self.font.render(summary, True, (255,0,0)), (40, 200))
        pygame.display.flip()
开发者ID:tushar2708,项目名称:eBookReader,代码行数:30,代码来源:reader.py

示例6: title_screen

def title_screen(episode=None):
    global firstEpisode, loadingGame
    textSurface = None
    titleImage = None
    try:
        titleImage = pygame.image.load(TITLE_IMAGES[0]).convert()
        titleImage = pygame.transform.scale(titleImage, (pygame.display.Info().current_w, pygame.display.Info().current_h))
    except IOError:
        textSurface = textrect.render_textrect(get_title(), #+ (":" if get_subtitle() != "" else ""), 
                universal.font, universal.worldView, LIGHT_GREY, DARK_GREY, 1)
    except IndexError:
        textSurface = textrect.render_textrect(get_title(), #+ (":" if get_subtitle() != "" else ""), 
                universal.font, universal.worldView, LIGHT_GREY, DARK_GREY, 1)
    titleImages = []
    if os.path.exists(os.path.join(os.getcwd(), 'save')) and '.init.sav' in os.listdir(os.path.join(os.getcwd(), 'save')):
        #townmode.clear_rooms()
        townmode.previousMode = None
        townmode.load_game('.init.sav', preserveLoadName=False)
    else:
        townmode.save_game('.init.sav', preserveSaveName=False)
    assert(episode is not None or firstEpisode is not None)
    if episode is not None:
        firstEpisode = episode
    screen = universal.get_screen()
    worldView = universal.get_world_view()
    background = universal.get_background()
    screen.fill(universal.DARK_GREY)
    font = pygame.font.SysFont(universal.FONT_LIST, 50)
    wvMidLeft = worldView.midleft
    if loadingGame:
        for i in range(1, len(TITLE_IMAGES)):
            try:
                titleImages.append(pygame.image.load(TITLE_IMAGES[i]))
                titleImages[-1] = pygame.transform.scale(titleImages[-1], (pygame.display.Info().current_w, pygame.display.Info().current_h))
            except IOError:
                continue
        opening_crawl()
        loadingGame = False
    music.play_music(music.THEME)
    universal.set_commands(['(S)tart', '(L)oad', '(A)cknowledgments', '(Esc)Quit'])
    universal.set_command_interpreter(title_screen_interpreter)
    if not skip:
        pygame.time.delay(125)
        for i in range(0, len(titleImages)):
            screen.blit(titleImages[i], worldView.topleft)
            pygame.time.delay(25)
            pygame.display.flip()
    if titleImage is not None:
        screen.blit(titleImage, worldView.topleft)
    else:
        screen.blit(textSurface, worldView.centerleft)
    pygame.display.flip()
    while 1:
        universal.textToDisplay = ''
        universal.titleText = ''
        for event in pygame.event.get():
            if event.type == KEYUP:
                return [universal.get_command_view()]
开发者ID:thingywhat,项目名称:PotionWars,代码行数:58,代码来源:titleScreen.py

示例7: makeXPBox

    def makeXPBox(self):
        self.xpMeter = meter.Meter(
            (0, 0),
            PLANNING_XP_BAR_SIZE[0],
            PLANNING_XP_BAR_SIZE[1],
            self.xp,
            PLANNING_XP_BAR_COLOR_FULL,
            PLANNING_XP_BAR_COLOR_EMPTY,
        )
        tempHeight = PLANNING_XP_BAR_SIZE[1]
        if tempHeight < PLANNING_XP_TEXT_SIZE[1]:
            tempHeight = PLANNING_XP_TEXT_SIZE[1]
        tempRect = pygame.Rect(
            (0, 0),
            (
                PLANNING_XP_BAR_SIZE[0] + (PLANNING_XP_BAR_PADDING * 3) + PLANNING_XP_TEXT_SIZE[0],
                tempHeight + (PLANNING_XP_BAR_PADDING * 4) + (PLANNING_XP_TEXT2_SIZE[1] * 2),
            ),
        )
        self.xpBox = box.Box(
            tempRect, PLANNING_BOX_PATTERN, PLANNING_BOX_PATTERN_SIZE, PLANNING_BOX_BORDER, PLANNING_BOX_BORDER_SIZE
        )

        tempRect = pygame.Rect(
            (PLANNING_XP_BAR_PADDING, PLANNING_XP_BAR_PADDING), (PLANNING_XP_TEXT_SIZE[0], PLANNING_XP_TEXT_SIZE[1])
        )
        tempFont = pygame.font.Font(PLANNING_BOX_FONT, PLANNING_BOX_FONT_SIZE)
        textSurface = textrect.render_textrect("EXP", tempFont, tempRect, BOX_FONT_COLOR, (0, 0, 0), 1, True)
        self.xpBox.mainPane.blit(textSurface, tempRect.topleft)
        self.xpTextRect = tempRect

        tempRect = pygame.Rect(
            (PLANNING_XP_BAR_PADDING, PLANNING_XP_BAR_PADDING + tempRect.height),
            (PLANNING_XP_TEXT2_SIZE[0], PLANNING_XP_TEXT2_SIZE[1]),
        )
        textSurface = textrect.render_textrect("Reserve:", tempFont, tempRect, BOX_FONT_COLOR, (0, 0, 0), 0, True)
        self.xpBox.mainPane.blit(textSurface, tempRect.topleft)

        self.rectReserve = pygame.Rect(tempRect)
        self.rectReserve.right = self.xpBox.rect.width - PLANNING_XP_BAR_PADDING

        tempRect.top += tempRect.height + PLANNING_XP_BAR_PADDING
        textSurface = textrect.render_textrect("Next Lvl:", tempFont, tempRect, BOX_FONT_COLOR, (0, 0, 0), 0, True)
        self.xpBox.mainPane.blit(textSurface, tempRect.topleft)

        self.rectNext = pygame.Rect(tempRect)
        self.rectNext.right = self.xpBox.rect.width - PLANNING_XP_BAR_PADDING

        self.xpBox.rect.top = self.pieceBox.box.rect.bottom + 5
        self.xpBox.center(ENTIRE_SCREEN, True, False)
        self.xpMeter.center(self.xpBox.rect, True, False)
        self.xpMeter.loc[1] += PLANNING_XP_BAR_PADDING
        self.xpMeter.loc[0] += self.xpBox.rect.left + (PLANNING_XP_TEXT_SIZE[0] / 2)
        self.xpMeter.loc[1] += self.xpBox.rect.top
开发者ID:Wopple,项目名称:Mage,代码行数:54,代码来源:planningScreen.py

示例8: updateXP

    def updateXP(self):
        tempFont = pygame.font.Font(PLANNING_BOX_FONT, PLANNING_BOX_FONT_SIZE)

        self.surfaceReserve = textrect.render_textrect(
            str(self.xp), tempFont, self.rectReserve, BOX_FONT_COLOR, (0, 0, 0), 2, True
        )

        if self.validCharacter():
            tempText = str(self.currNextLevel())
        else:
            tempText = ""
        self.surfaceNext = textrect.render_textrect(
            tempText, tempFont, self.rectNext, BOX_FONT_COLOR, (0, 0, 0), 2, True
        )
开发者ID:Wopple,项目名称:Mage,代码行数:14,代码来源:planningScreen.py

示例9: __init__

    def __init__(self, chapterNumber, chapterName):

        chapterNumber += 1
        
        pattern1 = pygame.image.load(os.path.join(GRAPHICS_PATH, CHAPTER_NAME_PATTERN)).convert_alpha()
        pattern2 = pygame.transform.flip(pattern1, True, False)
        border1 = pygame.image.load(os.path.join(GRAPHICS_PATH, CHAPTER_NAME_BORDER)).convert_alpha()
        border2 = pygame.transform.rotate(border1, 90)
        border3 = pygame.transform.rotate(border1, 180)
        border4 = pygame.transform.rotate(border1, 270)

        font1 = pygame.font.Font(FONTS[0], CHAPTER_NAME_FONTSIZE1)
        font2 = pygame.font.Font(FONTS[0], CHAPTER_NAME_FONTSIZE2)

        sizeX = (CHAPTER_NAME_PATTERN_SIZE * 2)
        sizeY = CHAPTER_NAME_BAR_HEIGHT
        posX = (SCREEN_SIZE[0] / 2) - (sizeX / 2)
        posY = (SCREEN_SIZE[1] / 2) - (sizeY / 2)
        self.rect = pygame.Rect( (posX, posY), (sizeX, sizeY))
        self.box = pygame.Surface( (sizeX, sizeY) )

        #Create Primary Bar
        for y in range (sizeY):
            self.box.blit(pattern1, (0, y))
            tempX = (int(sizeX / 2))
            self.box.blit(pattern2, (tempX, y))

        
        #Create Text
        tempRect = pygame.Rect( (0, (CHAPTER_NAME_BORDER_SIZE + 2)), (self.rect.width, (CHAPTER_NAME_FONTSIZE1 + 4)) )
        tempText = "Chapter " + str(chapterNumber)
        textrect1 = textrect.render_textrect(tempText, font1, tempRect, CHAPTER_NAME_COLOR, (0, 0, 0), 1, True)
        self.box.blit(textrect1, tempRect.topleft)

        tempRect = pygame.Rect( (0, 0), (self.rect.width, (CHAPTER_NAME_FONTSIZE2 + 4)) )
        tempRect.top = (self.rect.height / 2) - (tempRect.height / 2)
        textrect2 = textrect.render_textrect(chapterName, font2, tempRect, CHAPTER_NAME_COLOR, (0, 0, 0), 1, True)
        self.box.blit(textrect2, tempRect.topleft)

        #Create Border Sides
        for y in range (sizeY):
            self.box.blit(border2, (0, y))
            tempX = sizeX - CHAPTER_NAME_BORDER_SIZE
            self.box.blit(border4, (tempX, y))
        for x in range(sizeX):
            self.box.blit(border1, (x, 0))
            tempY = sizeY - CHAPTER_NAME_BORDER_SIZE
            self.box.blit(border3, (x, tempY))
开发者ID:Wopple,项目名称:Mage,代码行数:48,代码来源:chapterNameBox.py

示例10: printText

def printText(screen, mousePos):
    pos = getZoomPos(mousePos)
    pixelPos = posRelatedToAnchor(pos)
    text = textrect.render_textrect(str(pixelPos), FONTS[0],
                                    Rect((0, 0), (SCREEN_SIZE[0], SCREEN_SIZE[1])),
                                    (250, 250, 250), (5, 5, 5), 0, True)
    screen.blit(text, (mousePos[0] + 15, mousePos[1] - 10))
开发者ID:Wopple,项目名称:fimbulvetr,代码行数:7,代码来源:hitboxviewer.py

示例11: Render

        def Render(self):

                # determine color scheme according to textbox status
                if self.Enabled == True:
                        if self.Clicked == True:
                                self.bordercolor = self.ColorBorderClick
                                self.textcolor = self.ColorTextClick
                        else:
				self.bordercolor = self.ColorBorderNormal
				self.textcolor = self.ColorTextNormal
                else:
                        self.bordercolor = self.ColorBorderDisabled
                        self.textcolor = self.ColorTextDisabled

                # draw textbox if visible
                if self.Visible == True:
			# textbox border set to visible?
			if self.BorderVisible == True:
	                        # yes, draw border and background
	                        pygame.draw.rect(self.Surface, self.bordercolor,(self.PosX, self.PosY, self.SizeX, self.SizeY))
	                        pygame.draw.rect(self.Surface, self.ColorBackground,(self.PosX+1, self.PosY+1, self.SizeX-2, self.SizeY-2))
			else:
				# no, draw only background
				pygame.draw.rect(self.Surface, self.ColorBackground,(self.PosX, self.PosY, self.SizeX, self.SizeY))
                        # draw button text
                        self.fontObject = pygame.font.Font(self.FontPath, self.FontSize)
                        # multiline text, use word wrapped drawing method
                        self.textrectangle = pygame.Rect((self.PosX + 1, self.PosY + 1, self.SizeX - 2, self.SizeY - 2))
                        self.textSurface = textrect.render_textrect(self.Text, self.fontObject, self.textrectangle, self.textcolor, self.ColorBackground, self.TextAlignHorizontal)
                        self.Surface.blit(self.textSurface, self.textrectangle)
                else:
                        # draw background color rectangle if invisible
			# TODO: implement background buffering/redrawing
                        pygame.draw.rect(self.Surface, self.ColorBackground, (self.PosX, self.PosY, self.SizeX, self.SizeY))
开发者ID:niston,项目名称:touchGUI,代码行数:34,代码来源:touchGUI.py

示例12: __init__

 def __init__(self, fade):
     super(Model, self).__init__()
     
     self.bg = pygame.Surface(SCREEN_SIZE)
     self.bg.fill(BLACK)
     
     creditData =    [
                         ["Christopher \"Southpaw Hare\" Czyzewski", ["Lead Designer", "Lead Programmer", "Creative Director",
                                                                      "Marketing Director", "Distribution Director"]],
                         ["Daniel \"Wopple\" Tashjian", ["Programmer", "Tester"]]
                         ["Matthew Grisham", ["Gameplay Designer", "Map Designer"]],
                         ["Kit", ["Character Artist", "Map Artist", "Background Artist"]],
                         ["Raquel M. Richardson", ["Portrait Artist"]],
                         
                         ["Additional Testers", ["Randy Sabella", "Robert Morris", "Eric Collins", "Fox Zeta", "Coffeefox"]]
                     ]
     
     for data in creditData:
         header = data[0]
         subItems = data[1]
         
         headerRect = Rect((0, 0), (40, SCREEN_SIZE[1]))
         headerImage = textrect.render_textrect(header, CREDITS_HEADER_FONT, headerRect, ALMOST_BLACK, WHITE, 0, True)
         self.credits.append(CreditText(headerRect, headerImage))
     
     self.credits = []
开发者ID:Wopple,项目名称:fimbulvetr,代码行数:26,代码来源:credits_m.py

示例13: show

	def show(self):
		headlineFont = pygame.font.Font("leddigital.ttf", 70)
		font = pygame.font.Font(None, 50)
		run = True
		while run:
			inp = self.nowPlaying()

			# quit on "window close" and Escape
			for evt in pygame.event.get():
				if evt.type == KEYDOWN:
					if evt.key == K_ESCAPE:
						run = False
				elif evt.type == QUIT:
					return
			self.screen.fill((0, 0, 0))

			headline = headlineFont.render("mpd - Now playing:", True, (255, 0, 0))
			self.screen.blit(headline, (0, 0))

			# try to render all text and cut off if it's too large
			textRendered = False

			while not textRendered:
				try:
					# draw text and handle line breaks properly
					textSurface = render_textrect(inp, headlineFont, \
						self.screen.get_rect(), (255, 255, 255), (0, 0, 0))
					textRendered = True
				except TextRectException:
					# cut char off
					inp = inp[:-1]

			self.screen.blit(textSurface, (0, 120))
			pygame.display.flip()
			time.sleep(1)
开发者ID:basti2342,项目名称:mpc-display,代码行数:35,代码来源:mpc-display.py

示例14: createImage

    def createImage(self):
        global STAT_BOX_IMAGE
        global STAT_BOX_SIZE

        statText = ["STR", "MAG", "SKI", "VIT", "WIL", "SPD"]
        elements = []
        tempRect = pygame.Rect( (0, 0), STAT_BOX_ELEMENT_SIZE )
        tempFont = pygame.font.Font(STAT_BOX_FONT, STAT_BOX_FONT_SIZE)
        for x in range(6):
            textrect1 = textrect.render_textrect(statText[x], tempFont, tempRect,
                                                 BOX_FONT_COLOR, (0, 0, 0), 0, True)
            elements.append(textrect1)

        sizeX = (STAT_BOX_ELEMENT_SIZE[0] * 2) + (STAT_BOX_BORDER_SIZE * 2) + (STAT_BOX_PADDING * 3)
        sizeY = (STAT_BOX_ELEMENT_SIZE[1] * 3) + (STAT_BOX_BORDER_SIZE * 2) + (STAT_BOX_PADDING * 2)
        STAT_BOX_SIZE = (sizeX, sizeY)
        tempRect = pygame.Rect((0, 0), (sizeX, sizeY))
        tempBox = box.Box(tempRect, STAT_BOX_PATTERN, STAT_BOX_PATTERN_SIZE,
                           STAT_BOX_BORDER, STAT_BOX_BORDER_SIZE)
        for col in range(2):
            for row in range(3):
                x, tempX, tempY = self.getXXY(col, row)
                tempBox.mainPane.blit(elements[x], (tempX, tempY))

        STAT_BOX_IMAGE = tempBox.mainPane
开发者ID:Wopple,项目名称:Mage,代码行数:25,代码来源:statbox.py

示例15: draw

	def draw( self):
		# Clear the screen
		#self.set_video_mode()
		#self.background=pygame.image.tostring(self.screen, 'RGB')
		self.screen.fill((255,255,255))

		# Draw the title
		xw,yh = self.titlefont.size("W")
		x1=(self.screen_width-740)/2
		y1=self.titletop
		x2=self.screen_width-x1
		y2= self.titletop+(yh*2+2)
		title_rec = pygame.Rect(x1,y1,x2,y2)
		rendered_text=textrect.render_textrect(self.title, self.titlefont, title_rec , (0,0,255), (255,255,255),1)
		textpos=rendered_text.get_rect()
		textpos.centerx=self.screen.get_rect().centerx
		textpos[1]=y1
		self.screen.blit(rendered_text,textpos)
		#
		#Draw Input Text Rectangle
		xw,yh = self.font.size("W")
		x1=int ((self.screen_width-750)/2)
		y1=self.texttop-5
		x2=750
		y2= yh+10
		text_rec=pygame.Rect(x1, y1 , x2 , y2 )
		pygame.draw.rect(self.screen,(0,0,0),text_rec, 1)

		# Draw the keyboard
		self.screen.blit( self.image, (self.xpos, self.ypos))
		
		#update the screen
		pygame.display.update()

		self.draw_text()
开发者ID:afnfun,项目名称:EVMCV,代码行数:35,代码来源:onscreenkeyboard.py


注:本文中的textrect.render_textrect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。