import pygame import displayControler as dCon import Colors class Ui: def __init__(self,screen): self.screen=screen self.font='freesansbold.ttf' #Feel free to change it :D self.font_size=int(16) def render_text(self,string_to_print): font=pygame.font.Font(self.font,self.font_size) text=font.render(string_to_print,True,Colors.BLACK,Colors.WHITE) textRect=text.get_rect() textRect.center=(dCon.getGameWidth() // 2,dCon.getScreenHeihgt() // 2) self.screen.blit(text,textRect) def render_text_to_console(self,string_to_print): font=pygame.font.Font(self.font,self.font_size) self.break_string_to_console(string_to_print) line=10 for string in self.to_print: text=font.render(string,True,Colors.BLACK,Colors.WHITE) textRect=text.get_rect() textRect.center=(dCon.getGameWidth()+350/2,line) textRect.scale_by(x=350,y=100) self.screen.blit(text,textRect) line=line+18 def break_string_to_console(self,string_to_print): self.to_print=string_to_print.split(" ")