started adding architecture for CPU integration

This commit is contained in:
Vincent Rodley 2025-09-02 12:07:28 +12:00
parent 29e88aaf75
commit 7fee99cce8

View File

@ -172,7 +172,16 @@ y = WINDOW_HEIGHT / 2 - height / 2
start_button = Button(x, y - 100, width, height, "Start Game", start_button = Button(x, y - 100, width, height, "Start Game",
primary_colour, hover_colour, text_colour, primary_colour, hover_colour, text_colour,
lambda *_: start_game(), font, 50, rounding=8) lambda *_: menu_manager.change_menu("mode_pick"),
font, 50, rounding=8)
pvp_button = Button(x, y-height/1.5, width, height, "Player vs Player",
primary_colour, hover_colour, text_colour,
lambda *_: start_game("pvp"), font, 50, rounding=8)
pvc_button = Button(x, y+height/1.5, width, height, "Player vs CPU",
primary_colour, hover_colour, text_colour,
lambda *_: start_game("cpu"), font, 50, rounding=8)
settings_button = Button(x, y - 100 + height * 2, width, height, "Settings", settings_button = Button(x, y - 100 + height * 2, width, height, "Settings",
primary_colour, hover_colour, text_colour, primary_colour, hover_colour, text_colour,
@ -194,14 +203,18 @@ game_over_text = Button(x, 50, width, height / 1.5, "text",
None, font, 50, rounding=8) None, font, 50, rounding=8)
# menu callbacks # menu callbacks
def start_game(): def start_game(mode):
global board_full, player, winner, cursor_col if mode == "pvp":
global board_full, winner, player, cursor_col, last_tile
board_full = False board_full = False
winner = None winner = None
player = "red" player = "red"
cursor_col = COLS // 2 cursor_col = COLS // 2
last_tile = None
create_tiles() create_tiles()
menu_manager.change_menu("game") menu_manager.change_menu("game")
elif mode == "cpu":
print("not implemented yet. give me money and i might make it fr")
def draw_settings(display): def draw_settings(display):
text_surface = font.render("No settings yet :(", True, text_colour) text_surface = font.render("No settings yet :(", True, text_colour)
@ -289,6 +302,10 @@ menu_manager.register_menu("start",
buttons=[start_button, settings_button] buttons=[start_button, settings_button]
) )
menu_manager.register_menu("mode_pick",
buttons=[pvp_button, pvc_button]
)
menu_manager.register_menu("settings", menu_manager.register_menu("settings",
buttons=[go_back_button], buttons=[go_back_button],
draw=draw_settings draw=draw_settings