snake_move #16
3
App.py
3
App.py
@ -10,7 +10,8 @@ import Ui
|
||||
|
||||
|
||||
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
|
||||
clock=pygame.time.Clock()
|
||||
image_loader=Image.Image()
|
||||
|
4
Ui.py
4
Ui.py
@ -12,7 +12,7 @@ class Ui:
|
||||
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.getScreenWidth() // 2,dCon.getScreenHeihgt() // 2)
|
||||
textRect.center=(dCon.getGameWidth() // 2,dCon.getScreenHeihgt() // 2)
|
||||
self.screen.blit(text,textRect)
|
||||
|
||||
def render_text_to_console(self,string_to_print):
|
||||
@ -25,7 +25,7 @@ class Ui:
|
||||
textRect.center=(dCon.getGameWidth()+350/2,line)
|
||||
textRect.scale_by(x=350,y=100)
|
||||
self.screen.blit(text,textRect)
|
||||
line=line+10
|
||||
line=line+18
|
||||
|
||||
def break_string_to_console(self,string_to_print):
|
||||
self.to_print=string_to_print.split(" ")
|
||||
|
@ -11,14 +11,22 @@ def isValidMove(x, y):
|
||||
return True
|
||||
|
||||
|
||||
def getScreenHeihgt():
|
||||
return NUM_Y * CUBE_SIZE
|
||||
|
||||
def getGameWidth():
|
||||
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():
|
||||
return 350
|
||||
|
Loading…
Reference in New Issue
Block a user