pygame 텍스트 그리기

1055 단어
    def drawText(self,text,posx,posy,textHeight=48,fontColor=(0,0,0),backgroudColor=(255,255,255)):
        fontObj = pygame.font.Font('simkai.ttf', textHeight)  #  
        textSurfaceObj = fontObj.render(text, True,fontColor,backgroudColor)  #  
        textRectObj = textSurfaceObj.get_rect()  #  rect
        textRectObj.center = (posx, posy)  #  
        self.screen.blit(textSurfaceObj, textRectObj)  #  

 
전재 대상:https://www.cnblogs.com/superxuezhazha/p/6690554.html

좋은 웹페이지 즐겨찾기