BFS #17

Merged
s481834 merged 20 commits from BFS into master 2024-04-24 17:44:08 +02:00
3 changed files with 17 additions and 8 deletions
Showing only changes of commit 7ac1093231 - Show all commits

3
App.py
View File

@ -10,7 +10,8 @@ import Ui
pygame.init() pygame.init()
screen = pygame.display.set_mode((dCon.getScreenWidth(), dCon.getScreenHeihgt())) show_console=True
screen = pygame.display.set_mode((dCon.getScreenWidth(show_console), dCon.getScreenHeihgt()))
FPS=5 FPS=5
clock=pygame.time.Clock() clock=pygame.time.Clock()
image_loader=Image.Image() image_loader=Image.Image()

4
Ui.py
View File

@ -12,7 +12,7 @@ class Ui:
font=pygame.font.Font(self.font,self.font_size) font=pygame.font.Font(self.font,self.font_size)
text=font.render(string_to_print,True,Colors.BLACK,Colors.WHITE) text=font.render(string_to_print,True,Colors.BLACK,Colors.WHITE)
textRect=text.get_rect() textRect=text.get_rect()
textRect.center=(dCon.getScreenWidth() // 2,dCon.getScreenHeihgt() // 2) textRect.center=(dCon.getGameWidth() // 2,dCon.getScreenHeihgt() // 2)
self.screen.blit(text,textRect) self.screen.blit(text,textRect)
def render_text_to_console(self,string_to_print): def render_text_to_console(self,string_to_print):
@ -25,7 +25,7 @@ class Ui:
textRect.center=(dCon.getGameWidth()+350/2,line) textRect.center=(dCon.getGameWidth()+350/2,line)
textRect.scale_by(x=350,y=100) textRect.scale_by(x=350,y=100)
self.screen.blit(text,textRect) self.screen.blit(text,textRect)
line=line+10 line=line+18
def break_string_to_console(self,string_to_print): def break_string_to_console(self,string_to_print):
self.to_print=string_to_print.split(" ") self.to_print=string_to_print.split(" ")

View File

@ -11,14 +11,22 @@ def isValidMove(x, y):
return True return True
def getScreenHeihgt():
return NUM_Y * CUBE_SIZE
def getGameWidth(): def getGameWidth():
return NUM_X * CUBE_SIZE return NUM_X * CUBE_SIZE
def getScreenWidth():
return getGameWidth()+350
def getScreenHeihgt():
return NUM_Y * CUBE_SIZE
def getScreenWidth(show_console):
screen_width=getGameWidth()
if(show_console):
print("true")
screen_width=screen_width+350
return screen_width
def getConsoleWidth(): def getConsoleWidth():
return 350 return 350