-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
140 lines (74 loc) · 2.92 KB
/
main.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import os
from tkinter.constants import FALSE
import pygame
from board import board
import gui
pygame.init()
pygame.font.init()
width = 800
height = 800
window = pygame.display.set_mode((width,height))
pygame.display.set_caption('cellEditor')
b = board(window,width,height)
g = gui.Gui(window,width,height)
def main():
running = True
while running:
pygame.time.delay(20)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
g.pause_menu_display()
if event.key == pygame.K_c:
if g.is_edit:
b.field = b.set_clear_field()
b.field[0][0] = b.player
b.player_x = 0
b.player_y = 0
if g.is_edit and g.file_selected and not g.is_pause:
# if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
b.place_selected(event)
# g.is_pause = False
b.player_actions(event)
g.gui_event_handler(event)
window.fill((255, 255, 255))
if g.file_selected and g.is_edit:
b.player_x = b.player_x
if g.is_loading_file:
b.load_from_file(g.file_num)
g.is_loading_file = False
if not g.is_pause:
b.show()
b.highlight_cell()
#print('lol')
if g.file_selected and g.is_play:
if g.is_loading_file:
b.load_from_file(g.file_num)
g.is_loading_file = False
b.show()
if g.is_pause:
g.pause_menu_display()
if g.is_saving:
b.save_to_new_file()
g.is_saving = False
if g.is_overwiting:
b.save_to_current_file(g.file_num)
g.is_overwiting = False
if g.is_edit == False and g.is_play == False:
g.main_page_display()
if g.file_selected == False and g.is_edit:
g.file_selector_display()
if g.file_selected == False and g.is_play:
g.file_selector_display()
# if g.is_edit and g.file_selected:
# g.show_overlay_buttons()
if g.is_creating_file:
b.create_plain_file()
g.is_creating_file = False
#g.pause_menu_display()
pygame.display.update()
pygame.quit()
if __name__ == '__main__':
main()