Skip to content

Commit

Permalink
Create main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhustas authored Jun 30, 2023
1 parent 5e25033 commit 736a79a
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from pyray import *
from menu import Menu
from CG import CreatingGame
from game import Game

WINDOW_WIDTH = 1400
WINDOW_HEIGHT = 900
WINDOW_NAME = "Monopoly"

init_window(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_NAME)

output = 0

menu = Menu(WINDOW_WIDTH, WINDOW_HEIGHT, "data\Logo.png")
cg = CreatingGame(WINDOW_WIDTH, WINDOW_HEIGHT, "data\To_menu.png", "data\To_exit.png")
cg.init()
game = Game(WINDOW_WIDTH, WINDOW_HEIGHT)

set_target_fps(60)
while not window_should_close():
if menu.in_menu:
output = menu.check_input()

if output == 1:
menu.in_menu = False
cg.in_creating = True
elif output == -1:
break

if cg.in_creating:
output = cg.check_input()

if output == 1:
menu.in_menu = True
cg.in_creating = False
cg = CreatingGame(WINDOW_WIDTH, WINDOW_HEIGHT, "data\To_menu.png", "data\To_exit.png")
cg.init()
elif output == 10:
cg.in_creating = False
game.in_game = True
game.set_information(cg.get_information())
cg = CreatingGame(WINDOW_WIDTH, WINDOW_HEIGHT, "data\To_menu.png", "data\To_exit.png")
cg.init()
elif output == -1:
break

if game.in_game:
output = game.check_input()

if output == 1:
menu.in_menu = True
game.in_game = False
game = Game(WINDOW_WIDTH, WINDOW_HEIGHT)
elif output == -1:
break

begin_drawing()

if menu.in_menu:
menu.show()

if cg.in_creating:
cg.show()

if game.in_game:
game.show()

end_drawing()

close_window()

0 comments on commit 736a79a

Please sign in to comment.