def CreateGui(guiMan): print 'CreateGui' guiMan.setTransparency(1.0) guiMan.setFont("data/gui/fonthaettenschweiler.bmp") towerButton3 = gui.create_button(guiMan, 'tower3', Pos2i(0,0), Pos2i(150,30), '') towerButton3.text = '3 Layer Towers of Hanoi' towerButton3.OnMouseLeftClick = lambda: getMod().start_tower(3) agentWindow = gui.create_window(guiMan, 'agentWindow', Pos2i(20, 20), Pos2i(150, 120), 'Agent') agentWindow.addChild(towerButton3) speedupValue = gui.create_text(guiMan, 'speedupEditBox', Pos2i(260, 30), Pos2i(100, 30), str(0)) speedupLabel = gui.create_text(guiMan, 'speedupLabel', Pos2i(10, 30), Pos2i(100, 30), 'Speedup:') speedupScroll = gui.create_scroll_bar(guiMan, 'speedupScroll', Pos2i(100, 30), Pos2i(150,20), True) speedupScroll.setMax(100) speedupScroll.setLargeStep(10) speedupScroll.setSmallStep(1) speedupScroll.setPos(0) getMod().set_speedup(0) speedupScroll.OnScrollBarChange = speedup_adjusted(speedupScroll, speedupValue) paramWindow = gui.create_window(guiMan, 'paramWindow', Pos2i(20, 500), Pos2i(300,100), 'Parameters') paramWindow.addChild(speedupLabel) paramWindow.addChild(speedupScroll) paramWindow.addChild(speedupValue)
def CreateGui(guiMan, mode): print 'CreateGui' guiMan.setTransparency(1.0) guiMan.setFont("data/gui/fonthaettenschweiler.bmp") ui = UI() # a collection of all the UI elements window_width = 250 # width control_height = 30 # height # AGENT SELECTION BOX x, y = 5, 2 * control_height + 5 w, h = window_width - 15, control_height - 10 ui.agentBoxLabel = gui.create_text(guiMan, 'agentLabel', Pos2i(x, y), Pos2i(3 * w / 10, h), 'Agent Type:') ui.agentComboBox = gui.create_combo_box(guiMan, "agentComboBox", Pos2i(x + 5 + 3 * w / 10, y), Pos2i(7 * w / 10, h)) ui.active_agents = [] for agent_name, agent_function, agent_mode in getMod().AGENTS: if mode == agent_mode: ui.active_agents.append((agent_name, agent_function, agent_mode)) ui.agentComboBox.addItem(agent_name) # START/RESET AND PAUSE/CONTINUE AGENT BUTTONS AND HELP BUTTON x, y = 5, 0 * control_height + 5 w, h = (window_width - 25) / 4, control_height - 5 ui.startAgentButton = gui.create_button(guiMan, 'startAgentButton', Pos2i(x, y), Pos2i(w, h), '') ui.pauseAgentButton = gui.create_button(guiMan, 'pauseAgentButton', Pos2i(x + w + 5, y), Pos2i(w, h), '') ui.helpButton = gui.create_button(guiMan, 'helpButton', Pos2i(x + 2 * w + 10, y), Pos2i(w, h), '') ui.exitButton = gui.create_button(guiMan, 'exitButton', Pos2i(x + 3 * w + 15, y), Pos2i(w, h), '') ui.startAgentButton.text = 'Start' ui.pauseAgentButton.text = 'Pause' ui.helpButton.text = 'Help' ui.exitButton.text = 'Exit' ui.pauseAgentButton.enabled = False ui.startAgentButton.OnMouseLeftClick = startAgent(ui) ui.pauseAgentButton.OnMouseLeftClick = pauseAgent(ui) ui.helpButton.OnMouseLeftClick = openWiki('BlocksWorldMod') ui.exitButton.OnMouseLeftClick = lambda: switchToHub() # SPEEDUP SLIDER x, y = 5, 1 * control_height + 5 w, h = window_width - 20, control_height - 5 ui.speedupLabel = gui.create_text(guiMan, 'speedupLabel', Pos2i(x, y), Pos2i(3 * w / 10, h), 'Speedup:') ui.speedupScroll = gui.create_scroll_bar(guiMan, 'speedupScroll', Pos2i(x + 5 + 3 * w / 10, y), Pos2i(3 * w / 5, h - 5), True) ui.speedupValue = gui.create_text(guiMan, 'speedupEditBox', Pos2i(x + 10 + 9 * w / 10, y), Pos2i(w / 10, h), str(0)) ui.speedupScroll.setMax(100) ui.speedupScroll.setLargeStep(10) ui.speedupScroll.setSmallStep(1) ui.speedupScroll.setPos(0) getMod().set_speedup(0) ui.speedupScroll.OnScrollBarChange = speedup_adjusted(ui) # THE WINDOW THAT HOLDS ALL THE CONTROLS ABOVE ui.agentWindow = gui.create_window( guiMan, 'agentWindow', Pos2i(10, 10), Pos2i(window_width, 3 * control_height + 25), 'Agent') ui.agentWindow.addChild(ui.agentBoxLabel) ui.agentWindow.addChild(ui.agentComboBox) ui.agentWindow.addChild(ui.startAgentButton) ui.agentWindow.addChild(ui.pauseAgentButton) ui.agentWindow.addChild(ui.helpButton) ui.agentWindow.addChild(ui.exitButton) ui.agentWindow.addChild(ui.speedupLabel) ui.agentWindow.addChild(ui.speedupScroll) ui.agentWindow.addChild(ui.speedupValue)
def CreateGui(guiMan): guiMan.setTransparency(1.0) guiMan.setFont("data/gui/fonthaettenschweiler.bmp") ui = UI() window_width = 300 # width control_height = 30 # height # AGENT SELECTION BOX x, y = 5, 4 * control_height + 5 w, h = window_width - 15, control_height - 10 ui.agentBoxLabel = gui.create_text(guiMan, 'agentLabel', Pos2i(x,y), Pos2i(3*w/10,h), 'Agent Type:') ui.agentComboBox = gui.create_combo_box(guiMan, "agentComboBox", Pos2i(x + 5 + 3*w/10, y), Pos2i(7*w/10, h)) for agent_name, agent_function, ee_enabled in AGENTS: ui.agentComboBox.addItem(agent_name) # EXPLORE/EXPLOIT TRADE-OFF SLIDER x, y = 5, 0 * control_height + 5 w, h = window_width - 20, control_height - 5 epsilon_percent = int(INITIAL_EPSILON * 100) ui.epsilonLabel = gui.create_text(guiMan, 'epsilonLabel', Pos2i(x, y), Pos2i(3*w/10, h), 'Exploit-Explore:') ui.epsilonScroll = gui.create_scroll_bar(guiMan, 'epsilonScroll', Pos2i(x + 3*w/10 + 5, y), Pos2i(6*w/10, h - 5), True) ui.epsilonValue = gui.create_text(guiMan, 'epsilonEditBox', Pos2i(x + 9*w/10 + 10, y), Pos2i(w/10, h), str(epsilon_percent)) ui.epsilonScroll.setMax(100) ui.epsilonScroll.setLargeStep(10) ui.epsilonScroll.setSmallStep(1) ui.epsilonScroll.setPos(epsilon_percent) ui.epsilonScroll.enabled = False ui.epsilonValue.visible = False ui.epsilonLabel.visible = False ui.epsilonScroll.visible = False getMod().set_epsilon(INITIAL_EPSILON) ui.epsilonScroll.OnScrollBarChange = epsilon_adjusted(ui) # START/RESET AND PAUSE/CONTINUE AGENT BUTTONS x, y = 5, 3 * control_height w, h = (window_width - 15) / 2, control_height - 5 ui.startAgentButton = gui.create_button(guiMan, 'startAgentButton', Pos2i(x, y), Pos2i(w, h), '') ui.pauseAgentButton = gui.create_button(guiMan, 'pauseAgentButton', Pos2i(x + w + 5, y), Pos2i(w, h), '') ui.startAgentButton.text = 'Start' ui.pauseAgentButton.text = 'Pause' ui.pauseAgentButton.enabled = False ui.startAgentButton.OnMouseLeftClick = startAgent(ui) ui.pauseAgentButton.OnMouseLeftClick = pauseAgent(ui) # HELP BUTTON w, h = (window_width - 15) / 2, control_height - 5 x, y = 5, 2 * control_height ui.helpButton = gui.create_button(guiMan, 'helpButton', Pos2i(x, y), Pos2i(w, h), '') ui.helpButton.text = 'Help' ui.helpButton.OnMouseLeftClick = openWiki('MazeMod') # NEW MAZE BUTTON x = 10 + w ui.newMazeButton = gui.create_button(guiMan, 'newMazeButton', Pos2i(x, y), Pos2i(w, h), '') ui.newMazeButton.text = 'New Maze' ui.newMazeButton.OnMouseLeftClick = lambda: getMod().generate_new_maze() # SPEEDUP SLIDER x, y = 5, 1 * control_height w, h = window_width - 20, control_height - 5 ui.speedupLabel = gui.create_text(guiMan, 'speedupLabel', Pos2i(x, y), Pos2i(3*w/10, h), 'Speedup:') ui.speedupScroll = gui.create_scroll_bar(guiMan, 'speedupScroll', Pos2i(x + 5 + 3*w/10, y), Pos2i(3*w/5, h-5), True) ui.speedupValue = gui.create_text(guiMan, 'speedupEditBox', Pos2i(x + 10 + 9*w/10, y), Pos2i(w/10, h), str(0)) ui.speedupScroll.setMax(100) ui.speedupScroll.setLargeStep(10) ui.speedupScroll.setSmallStep(1) ui.speedupScroll.setPos(0) getMod().set_speedup(0) ui.speedupScroll.OnScrollBarChange = speedup_adjusted(ui) # THE WINDOW THAT HOLDS ALL THE CONTROLS ABOVE ui.agentWindow = gui.create_window(guiMan, 'agentWindow', Pos2i(10, 10), Pos2i(window_width, 5*control_height+25), 'Agent') ui.agentWindow.addChild(ui.agentBoxLabel) ui.agentWindow.addChild(ui.agentComboBox) ui.agentWindow.addChild(ui.newMazeButton) ui.agentWindow.addChild(ui.startAgentButton) ui.agentWindow.addChild(ui.pauseAgentButton) ui.agentWindow.addChild(ui.helpButton) ui.agentWindow.addChild(ui.epsilonLabel) ui.agentWindow.addChild(ui.epsilonScroll) ui.agentWindow.addChild(ui.epsilonValue) ui.agentWindow.addChild(ui.speedupLabel) ui.agentWindow.addChild(ui.speedupScroll) ui.agentWindow.addChild(ui.speedupValue)
def CreateGui(guiMan, mode): guiMan.setTransparency(1.0) guiMan.setFont("data/gui/fonthaettenschweiler.bmp") ui = UI() window_width = 300 # width control_height = 30 # height # AGENT SELECTION BOX x, y = 5, 2 * control_height + 5 w, h = window_width - 15, control_height - 10 ui.agentBoxLabel = gui.create_text(guiMan, 'agentLabel', Pos2i(x, y), Pos2i(3 * w / 10, h), 'Agent Type:') ui.agentComboBox = gui.create_combo_box(guiMan, "agentComboBox", Pos2i(x + 5 + 3 * w / 10, y), Pos2i(7 * w / 10, h)) ui.active_agents = [] for agent_name, agent_function, ee_enabled, agent_mode in getMod().AGENTS: if mode == agent_mode: ui.active_agents.append( (agent_name, agent_function, ee_enabled, agent_mode)) ui.agentComboBox.addItem(agent_name) # EXPLORE/EXPLOIT TRADE-OFF SLIDER x, y = 5, 5 * control_height + 5 w, h = window_width - 20, control_height - 5 epsilon_percent = int(INITIAL_EPSILON * 100) ui.epsilonLabel = gui.create_text(guiMan, 'epsilonLabel', Pos2i(x, y), Pos2i(3 * w / 10, h), 'Explore-Exploit:') ui.epsilonScroll = gui.create_scroll_bar(guiMan, 'epsilonScroll', Pos2i(x + 3 * w / 10 + 5, y), Pos2i(6 * w / 10, h - 5), True) ui.epsilonValue = gui.create_text(guiMan, 'epsilonEditBox', Pos2i(x + 9 * w / 10 + 10, y), Pos2i(w / 10, h), str(epsilon_percent)) ui.epsilonScroll.setMax(100) ui.epsilonScroll.setLargeStep(10) ui.epsilonScroll.setSmallStep(1) ui.epsilonScroll.setPos(epsilon_percent) ui.epsilonScroll.enabled = False ui.epsilonValue.visible = False ui.epsilonLabel.visible = False ui.epsilonScroll.visible = False getMod().set_epsilon(INITIAL_EPSILON) ui.epsilonScroll.OnScrollBarChange = epsilon_adjusted(ui) # INITIAL DISTANCE SLIDER x, y = 5, 3 * control_height + 5 w, h = window_width - 20, control_height - 5 initdist = INITIAL_DIST ui.initdistLabel = gui.create_text(guiMan, 'initdistLabel', Pos2i(x, y), Pos2i(3 * w / 10, h), 'Starting Offset:') ui.initdistScroll = gui.create_scroll_bar(guiMan, 'initdistScroll', Pos2i(x + 3 * w / 10 + 5, y), Pos2i(6 * w / 10, h - 5), True) ui.initdistValue = gui.create_text(guiMan, 'initdistEditBox', Pos2i(x + 9 * w / 10 + 10, y), Pos2i(w / 10, h), str(initdist)) ui.initdistScroll.setMax(2 * ROWS - 3) ui.initdistScroll.setLargeStep(2) ui.initdistScroll.setSmallStep(1) ui.initdistScroll.setPos(initdist) # ui.initdistScroll.enabled = False # ui.initdistValue.visible = False # ui.initdistLabel.visible = False # ui.initdistScroll.visible = False ui.initdistScroll.enabled = True ui.initdistValue.visible = True ui.initdistLabel.visible = True ui.initdistScroll.visible = True getMod().set_initdist(INITIAL_DIST) ui.initdistScroll.OnScrollBarChange = initdist_adjusted(ui) # START/RESET AND PAUSE/CONTINUE AGENT BUTTONS x, y = 5, 1 * control_height + 5 w, h = (window_width - 15) / 2, control_height - 5 ui.startAgentButton = gui.create_button(guiMan, 'startAgentButton', Pos2i(x, y), Pos2i(w, h), '') ui.pauseAgentButton = gui.create_button(guiMan, 'pauseAgentButton', Pos2i(x + w + 5, y), Pos2i(w, h), '') ui.startAgentButton.text = 'Start' ui.pauseAgentButton.text = 'Pause' ui.pauseAgentButton.enabled = False ui.startAgentButton.OnMouseLeftClick = startAgent(ui) ui.pauseAgentButton.OnMouseLeftClick = pauseAgent(ui) # HELP BUTTON w, h = (window_width - 20) / 3, control_height - 5 x, y = 5, 0 * control_height + 5 ui.helpButton = gui.create_button(guiMan, 'helpButton', Pos2i(x, y), Pos2i(w, h), '') ui.helpButton.text = 'Help' ui.helpButton.OnMouseLeftClick = openWiki('MazeMod') # NEW MAZE BUTTON x = 10 + w ui.newMazeButton = gui.create_button(guiMan, 'newMazeButton', Pos2i(x, y), Pos2i(w, h), '') ui.newMazeButton.text = 'New Maze' ui.newMazeButton.OnMouseLeftClick = lambda: getMod().generate_new_maze() # EXIT BUTTON x = 15 + w * 2 ui.exitButton = gui.create_button(guiMan, 'exitButton', Pos2i(x, y), Pos2i(w, h), '') ui.exitButton.text = 'Exit' ui.exitButton.OnMouseLeftClick = lambda: switchToHub() # SPEEDUP SLIDER x, y = 5, 4 * control_height + 5 w, h = window_width - 20, control_height - 5 ui.speedupLabel = gui.create_text(guiMan, 'speedupLabel', Pos2i(x, y), Pos2i(3 * w / 10, h), 'Speedup:') ui.speedupScroll = gui.create_scroll_bar(guiMan, 'speedupScroll', Pos2i(x + 5 + 3 * w / 10, y), Pos2i(3 * w / 5, h - 5), True) ui.speedupValue = gui.create_text(guiMan, 'speedupEditBox', Pos2i(x + 10 + 9 * w / 10, y), Pos2i(w / 10, h), str(0)) ui.speedupScroll.setMax(100) ui.speedupScroll.setLargeStep(10) ui.speedupScroll.setSmallStep(1) ui.speedupScroll.setPos(0) getMod().set_speedup(0) ui.speedupScroll.OnScrollBarChange = speedup_adjusted(ui) # THE WINDOW THAT HOLDS ALL THE CONTROLS ABOVE ui.agentWindow = gui.create_window( guiMan, 'agentWindow', Pos2i(10, 10), Pos2i(window_width, 6 * control_height + 30), 'Agent') ui.agentWindow.addChild(ui.agentBoxLabel) ui.agentWindow.addChild(ui.agentComboBox) ui.agentWindow.addChild(ui.newMazeButton) ui.agentWindow.addChild(ui.exitButton) ui.agentWindow.addChild(ui.startAgentButton) ui.agentWindow.addChild(ui.pauseAgentButton) ui.agentWindow.addChild(ui.helpButton) ui.agentWindow.addChild(ui.epsilonLabel) ui.agentWindow.addChild(ui.epsilonScroll) ui.agentWindow.addChild(ui.epsilonValue) ui.agentWindow.addChild(ui.initdistLabel) ui.agentWindow.addChild(ui.initdistScroll) ui.agentWindow.addChild(ui.initdistValue) ui.agentWindow.addChild(ui.speedupLabel) ui.agentWindow.addChild(ui.speedupScroll) ui.agentWindow.addChild(ui.speedupValue)
def CreateGui(guiMan, mode): print 'CreateGui' guiMan.setTransparency(1.0) guiMan.setFont("data/gui/fonthaettenschweiler.bmp") ui = UI() # a collection of all the UI elements window_width = 250 # width control_height = 30 # height # AGENT SELECTION BOX x, y = 5, 1 * control_height + 5 w, h = window_width - 15, control_height - 10 ui.agentBoxLabel = gui.create_text(guiMan, 'agentLabel', Pos2i(x,y), Pos2i(3*w/10,h), 'Agent Type:') ui.agentComboBox = gui.create_combo_box(guiMan, "agentComboBox", Pos2i(x + 5 + 3*w/10, y), Pos2i(7*w/10, h)) ui.active_agents = [] for agent_name, agent_function, agent_mode in getMod().AGENTS: if mode == agent_mode: ui.active_agents.append((agent_name, agent_function, agent_mode)) ui.agentComboBox.addItem(agent_name) # START/RESET AND PAUSE/CONTINUE AGENT BUTTONS AND HELP BUTTON x, y = 5, 0 * control_height + 5 w, h = (window_width - 25) / 4, control_height - 5 ui.startAgentButton = gui.create_button(guiMan, 'startAgentButton', Pos2i(x, y), Pos2i(w, h), '') ui.pauseAgentButton = gui.create_button(guiMan, 'pauseAgentButton', Pos2i(x + w + 5, y), Pos2i(w, h), '') ui.helpButton = gui.create_button(guiMan, 'helpButton', Pos2i(x + 2*w + 10, y), Pos2i(w, h), '') ui.exitButton = gui.create_button(guiMan, 'exitButton', Pos2i(x + 3*w + 15, y), Pos2i(w, h), '') ui.startAgentButton.text = 'Start' ui.pauseAgentButton.text = 'Pause' ui.helpButton.text = 'Help' ui.exitButton.text = 'Exit' ui.pauseAgentButton.enabled = False ui.startAgentButton.OnMouseLeftClick = startAgent(ui) ui.pauseAgentButton.OnMouseLeftClick = pauseAgent(ui) ui.helpButton.OnMouseLeftClick = openWiki('BlocksWorldMod') ui.exitButton.OnMouseLeftClick = lambda: switchToHub() # SPEEDUP SLIDER x, y = 5, 2 * control_height + 5 w, h = window_width - 20, control_height - 5 ui.speedupLabel = gui.create_text(guiMan, 'speedupLabel', Pos2i(x, y), Pos2i(3*w/10, h), 'Speedup:') ui.speedupScroll = gui.create_scroll_bar(guiMan, 'speedupScroll', Pos2i(x + 5 + 3*w/10, y), Pos2i(3*w/5, h-5), True) ui.speedupValue = gui.create_text(guiMan, 'speedupEditBox', Pos2i(x + 10 + 9*w/10, y), Pos2i(w/10, h), str(0)) ui.speedupScroll.setMax(100) ui.speedupScroll.setLargeStep(10) ui.speedupScroll.setSmallStep(1) ui.speedupScroll.setPos(0) getMod().set_speedup(0) ui.speedupScroll.OnScrollBarChange = speedup_adjusted(ui) # THE WINDOW THAT HOLDS ALL THE CONTROLS ABOVE ui.agentWindow = gui.create_window(guiMan, 'agentWindow', Pos2i(10, 10), Pos2i(window_width, 3*control_height+25), 'Agent') ui.agentWindow.addChild(ui.agentBoxLabel) ui.agentWindow.addChild(ui.agentComboBox) ui.agentWindow.addChild(ui.startAgentButton) ui.agentWindow.addChild(ui.pauseAgentButton) ui.agentWindow.addChild(ui.helpButton) ui.agentWindow.addChild(ui.exitButton) ui.agentWindow.addChild(ui.speedupLabel) ui.agentWindow.addChild(ui.speedupScroll) ui.agentWindow.addChild(ui.speedupValue)
def CreateGui(guiMan, mode): guiMan.setTransparency(1.0) guiMan.setFont("data/gui/fonthaettenschweiler.bmp") ui = UI() window_width = 300 # width control_height = 30 # height # AGENT SELECTION BOX x, y = 5, 2 * control_height + 5 w, h = window_width - 15, control_height - 10 ui.agentBoxLabel = gui.create_text(guiMan, "agentLabel", Pos2i(x, y), Pos2i(3 * w / 10, h), "Agent Type:") ui.agentComboBox = gui.create_combo_box(guiMan, "agentComboBox", Pos2i(x + 5 + 3 * w / 10, y), Pos2i(7 * w / 10, h)) ui.active_agents = [] for agent_name, agent_function, ee_enabled, agent_mode in getMod().AGENTS: if mode == agent_mode: ui.active_agents.append((agent_name, agent_function, ee_enabled, agent_mode)) ui.agentComboBox.addItem(agent_name) # EXPLORE/EXPLOIT TRADE-OFF SLIDER x, y = 5, 5 * control_height + 5 w, h = window_width - 20, control_height - 5 epsilon_percent = int(INITIAL_EPSILON * 100) ui.epsilonLabel = gui.create_text(guiMan, "epsilonLabel", Pos2i(x, y), Pos2i(3 * w / 10, h), "Explore-Exploit:") ui.epsilonScroll = gui.create_scroll_bar( guiMan, "epsilonScroll", Pos2i(x + 3 * w / 10 + 5, y), Pos2i(6 * w / 10, h - 5), True ) ui.epsilonValue = gui.create_text( guiMan, "epsilonEditBox", Pos2i(x + 9 * w / 10 + 10, y), Pos2i(w / 10, h), str(epsilon_percent) ) ui.epsilonScroll.setMax(100) ui.epsilonScroll.setLargeStep(10) ui.epsilonScroll.setSmallStep(1) ui.epsilonScroll.setPos(epsilon_percent) ui.epsilonScroll.enabled = False ui.epsilonValue.visible = False ui.epsilonLabel.visible = False ui.epsilonScroll.visible = False getMod().set_epsilon(INITIAL_EPSILON) ui.epsilonScroll.OnScrollBarChange = epsilon_adjusted(ui) # INITIAL DISTANCE SLIDER x, y = 5, 3 * control_height + 5 w, h = window_width - 20, control_height - 5 initdist = INITIAL_DIST ui.initdistLabel = gui.create_text(guiMan, "initdistLabel", Pos2i(x, y), Pos2i(3 * w / 10, h), "Starting Offset:") ui.initdistScroll = gui.create_scroll_bar( guiMan, "initdistScroll", Pos2i(x + 3 * w / 10 + 5, y), Pos2i(6 * w / 10, h - 5), True ) ui.initdistValue = gui.create_text( guiMan, "initdistEditBox", Pos2i(x + 9 * w / 10 + 10, y), Pos2i(w / 10, h), str(initdist) ) ui.initdistScroll.setMax(2 * ROWS - 3) ui.initdistScroll.setLargeStep(2) ui.initdistScroll.setSmallStep(1) ui.initdistScroll.setPos(initdist) # ui.initdistScroll.enabled = False # ui.initdistValue.visible = False # ui.initdistLabel.visible = False # ui.initdistScroll.visible = False ui.initdistScroll.enabled = True ui.initdistValue.visible = True ui.initdistLabel.visible = True ui.initdistScroll.visible = True getMod().set_initdist(INITIAL_DIST) ui.initdistScroll.OnScrollBarChange = initdist_adjusted(ui) # START/RESET AND PAUSE/CONTINUE AGENT BUTTONS x, y = 5, 1 * control_height + 5 w, h = (window_width - 15) / 2, control_height - 5 ui.startAgentButton = gui.create_button(guiMan, "startAgentButton", Pos2i(x, y), Pos2i(w, h), "") ui.pauseAgentButton = gui.create_button(guiMan, "pauseAgentButton", Pos2i(x + w + 5, y), Pos2i(w, h), "") ui.startAgentButton.text = "Start" ui.pauseAgentButton.text = "Pause" ui.pauseAgentButton.enabled = False ui.startAgentButton.OnMouseLeftClick = startAgent(ui) ui.pauseAgentButton.OnMouseLeftClick = pauseAgent(ui) # HELP BUTTON w, h = (window_width - 20) / 3, control_height - 5 x, y = 5, 0 * control_height + 5 ui.helpButton = gui.create_button(guiMan, "helpButton", Pos2i(x, y), Pos2i(w, h), "") ui.helpButton.text = "Help" ui.helpButton.OnMouseLeftClick = openWiki("MazeMod") # NEW MAZE BUTTON x = 10 + w ui.newMazeButton = gui.create_button(guiMan, "newMazeButton", Pos2i(x, y), Pos2i(w, h), "") ui.newMazeButton.text = "New Maze" ui.newMazeButton.OnMouseLeftClick = lambda: getMod().generate_new_maze() # EXIT BUTTON x = 15 + w * 2 ui.exitButton = gui.create_button(guiMan, "exitButton", Pos2i(x, y), Pos2i(w, h), "") ui.exitButton.text = "Exit" ui.exitButton.OnMouseLeftClick = lambda: switchToHub() # SPEEDUP SLIDER x, y = 5, 4 * control_height + 5 w, h = window_width - 20, control_height - 5 ui.speedupLabel = gui.create_text(guiMan, "speedupLabel", Pos2i(x, y), Pos2i(3 * w / 10, h), "Speedup:") ui.speedupScroll = gui.create_scroll_bar( guiMan, "speedupScroll", Pos2i(x + 5 + 3 * w / 10, y), Pos2i(3 * w / 5, h - 5), True ) ui.speedupValue = gui.create_text(guiMan, "speedupEditBox", Pos2i(x + 10 + 9 * w / 10, y), Pos2i(w / 10, h), str(0)) ui.speedupScroll.setMax(100) ui.speedupScroll.setLargeStep(10) ui.speedupScroll.setSmallStep(1) ui.speedupScroll.setPos(0) getMod().set_speedup(0) ui.speedupScroll.OnScrollBarChange = speedup_adjusted(ui) # THE WINDOW THAT HOLDS ALL THE CONTROLS ABOVE ui.agentWindow = gui.create_window( guiMan, "agentWindow", Pos2i(10, 10), Pos2i(window_width, 6 * control_height + 30), "Agent" ) ui.agentWindow.addChild(ui.agentBoxLabel) ui.agentWindow.addChild(ui.agentComboBox) ui.agentWindow.addChild(ui.newMazeButton) ui.agentWindow.addChild(ui.exitButton) ui.agentWindow.addChild(ui.startAgentButton) ui.agentWindow.addChild(ui.pauseAgentButton) ui.agentWindow.addChild(ui.helpButton) ui.agentWindow.addChild(ui.epsilonLabel) ui.agentWindow.addChild(ui.epsilonScroll) ui.agentWindow.addChild(ui.epsilonValue) ui.agentWindow.addChild(ui.initdistLabel) ui.agentWindow.addChild(ui.initdistScroll) ui.agentWindow.addChild(ui.initdistValue) ui.agentWindow.addChild(ui.speedupLabel) ui.agentWindow.addChild(ui.speedupScroll) ui.agentWindow.addChild(ui.speedupValue)