def __init__(self, player_manager, origin, colour, name=""): self.player_manager = player_manager self.origin = origin self.colour = colour # Background self.back_panel = pygame_gui.Panel( [self.origin[0], self.origin[1], 500, 50], 100, constants.COLOURS["black"]) self.name_entry = pygame_gui.Entry( paths.uiMenuPath + "input-normal.png", paths.uiMenuPath + "input-normal-hover.png", paths.uiMenuPath + "input-normal-focused.png", paths.uiMenuPath + "input-normal-hover-focused.png", name, constants.FONTS["sizes"]["medium"], constants.FONTS["colour"], constants.FONTS["main"], 10, 5, True, self.origin[0] + 60, self.origin[1] + 10) self.delete_self = pygame_gui.Button(paths.uiPath + "cross.png", paths.uiPath + "cross-hover.png", self.origin[0] + 430, self.origin[1] + 8)
def __init__(self, display): self.display = display self.state = "new_game" self.game_reference = None # Background Setup self.background = pygame_gui.Image(paths.uiMenuPath + "background.png", 0, 0) self.back_panel = pygame_gui.Panel([100, 100, 800, 500], 150, constants.COLOURS["panel"]) # GUI Setup self.origin = [150, 30] # General self.back_button = pygame_gui.Button( paths.uiPath + "backwhite.png", paths.uiPath + "backwhite-hover.png", 5, 5) self.title_text = pygame_gui.Text("Create Game:", constants.FONTS["sizes"]["large"], constants.FONTS["colour"], constants.FONTS["main"], 110, 110) self.play_button = pygame_gui.Button( paths.uiPath + "forwardwhite.png", paths.uiPath + "forwardwhite-hover.png", self.origin[0] + 700, self.origin[1] + 525) # Game Input Setup self.game_name_prompt = pygame_gui.Text( "Game Name:", constants.FONTS["sizes"]["medium"], constants.FONTS["colour"], constants.FONTS["main"], self.origin[0] + 100, self.origin[1] + 150) self.game_name_input = pygame_gui.Entry( paths.uiMenuPath + "input-large.png", paths.uiMenuPath + "input-large-hover.png", paths.uiMenuPath + "input-large-focused.png", paths.uiMenuPath + "input-large-hover-focused.png", "", constants.FONTS["sizes"]["medium"], constants.FONTS["colour"], constants.FONTS["main"], 10, 5, True, self.origin[0] + 250, self.origin[1] + 145) self.game_name_error_text = pygame_gui.Text( "", constants.FONTS["sizes"]["small"], constants.COLOURS["red"], constants.FONTS["main-bold-italic"], self.origin[0] + 250, self.origin[1] + 180) # Map Input Setup self.map_select_prompt = pygame_gui.Text( "Select Map:", constants.FONTS["sizes"]["medium"], constants.FONTS["colour"], constants.FONTS["main"], self.origin[0] + 100, self.origin[1] + 200) self.map_selector = MapSelector(self.origin[0] + 250, self.origin[1] + 200) # Player Input Setup self.players_prompt = pygame_gui.Text( "Players:", constants.FONTS["sizes"]["medium"], constants.FONTS["colour"], constants.FONTS["main"], self.origin[0] + 100, self.origin[1] + 250) self.player_slots_error = pygame_gui.Text( "", constants.FONTS["sizes"]["small"], constants.COLOURS["red"], constants.FONTS["main-bold-italic"], self.origin[0] + 200, self.origin[1] + 255) self.player_manager = PlayerManager( 4, [self.origin[0] + 100, self.origin[1] + 290]) self.run()