-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPantallaPrincipal.py
64 lines (44 loc) · 1.42 KB
/
PantallaPrincipal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from Helper import *
import time
import SnakeTitle
import NewGame
Players = 1
CONTINUE="continue"
Screen = None
FULL_SCREEN=None
def createMainScreen(stdscr):
if(checkIfEnoughSpaceForGame(stdscr)):
raise NotEnoughSpace()
global Screen
global FULL_SCREEN
FULL_SCREEN=stdscr
Screen = stdscr.subwin(MINIMUM_HEIGHT, MINIMUM_WIDTH, 0,0 )
FULL_SCREEN.nodelay(False) # Makes getKey blocking
FULL_SCREEN.clear()
FULL_SCREEN.refresh()
Screen.box()
Screen.refresh()
maxY, maxX = Screen.getmaxyx()
titleStartX = int((maxX - SnakeTitle.TITLE_WIDTH) / 2)
SnakeTitle.SnakeTitle().main(Screen, startX=titleStartX, startY=2)
menu = [("New Game", newGameFunc), ("Scoreboard", scoreBoardFunc), ("Exit", exitFunc)]
maxLen= max([len(i[0]) for i in menu])
x = int((maxX - maxLen)/2)
y = int(maxY/2)
createMenu(Screen, menu, startX=x, startY=y)
Screen.refresh()
while menu_handler(FULL_SCREEN):
if(checkIfEnoughSpaceForGame(FULL_SCREEN)):
raise NotEnoughSpace()
return Players #TODO:Hauria de retornar una instancia de SnakeGame amb les snakes i config adequada
def exitFunc():
raise ExitTotal("Thank you for playing :3")
def setUpPlayers(players):
global Players
Players = players
return CONTINUE
def newGameFunc():
result = NewGame.newGame(Screen, FULL_SCREEN)
return CONTINUE
def scoreBoardFunc():
pass