def createGui(self): system = helpers.loadWindowLayout("system.layout") self.guiSystem.getGUISheet().addChildWindow(system) self.windows = [system] self.system = system helpers.bindButtonEvent("TopBar/MenuButton", self, "toggleMainMenu") helpers.bindButtonEvent("Windows/EndTurnButton", self, "requestEOT") helpers.bindEvent("Navigation/ZoomIn", self.starmap, "zoomIn", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/ZoomOut", self.starmap, "zoomOut", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/Deselect", self, "unselect", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/Center", self, "focus", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/Autofit", self.starmap, "autofit", cegui.Window.EventMouseButtonDown) self.message_window = gui.MessageWindow(self) self.design_window = gui.DesignsWindow(self) self.info_window = gui.InformationWindow(self) self.system_window = gui.SystemWindow(self) self.orders_window = gui.OrdersWindow(self) self.sub_windows = [ self.message_window, self.design_window, self.info_window, self.system_window, self.orders_window, ] wm = cegui.WindowManager.getSingleton() self.orders_menu = overlay.RadialMenu(self.camera) wm.getWindow("Starmap").addChildWindow(self.orders_menu.menu) self.information_overlay = overlay.InformationOverlay() wm.getWindow("Starmap").addChildWindow(self.information_overlay.overlay)
def __init__(self, parent, sceneManager): Scene.__init__(self, parent, sceneManager) # when populating a cegui list, must keep the references, otherwise segfault self.servers = [] login = helpers.loadWindowLayout("login.layout") self.guiSystem.getGUISheet().addChildWindow(login) self.windows.append(login) self.login = login # key states self.tab_down = False self.enter_down = False wm = cegui.WindowManager.getSingleton() wm.getWindow("Login/SaveDetails").setSelected(settings.save_details) if settings.user_name != None: wm.getWindow("Login/Username").setText(settings.user_name) if settings.password != None: wm.getWindow("Login/Password").setText(settings.password) if settings.previous_game != None: self.setServer(settings.previous_game) helpers.bindButtonEvent("Login/LoginButton", self, "onConnect") helpers.bindButtonEvent("Login/QuitButton", self, "quit") helpers.bindButtonEvent("Login/ConfigButton", self, "onConfig") helpers.bindEvent("Login/SaveDetails", self, "onSaveDetails", cegui.Checkbox.EventCheckStateChanged) helpers.bindButtonEvent("Message/OkButton", self, "onMessageOk") self.hide()
def __init__(self, window): self.config = helpers.loadWindowLayout("config.layout") window.addChildWindow(self.config) helpers.bindButtonEvent("Config/OK", self, "onConfigSave") helpers.bindButtonEvent("Config/Cancel", self, "onConfigCancel") helpers.bindButtonEvent("Config/Sound", self, "onSound") helpers.bindButtonEvent("Config/Graphics", self, "onGraphics") helpers.bindEvent("Config", self, "onConfigCancel", cegui.FrameWindow.EventCloseClicked) helpers.bindEvent("Config/Zoom", self, "onZoomChange", cegui.Slider.EventValueChanged) helpers.bindEvent("Config/ShowFps", self, "onShowFpsChange", cegui.Checkbox.EventCheckStateChanged) helpers.bindEvent("Sound", self, "onSoundCancel", cegui.FrameWindow.EventCloseClicked) helpers.bindButtonEvent("Sound/Cancel", self, "onSoundCancel") helpers.bindButtonEvent("Sound/OK", self, "onSoundSave") helpers.bindEvent("Graphics", self, "onGraphicsCancel", cegui.FrameWindow.EventCloseClicked) helpers.bindButtonEvent("Graphics/Cancel", self, "onGraphicsCancel") helpers.bindButtonEvent("Graphics/OK", self, "onGraphicsSave") helpers.toggleWindow("Config").activate() wm = cegui.WindowManager.getSingleton() wm.getWindow("Config/Zoom").currentValue = settings.icon_zoom_switch_level wm.getWindow("Config/ZoomSpeed").setMaxValue(self.max_zoom_speed) wm.getWindow("Config/ZoomSpeed").currentValue = settings.zoom_speed - 1 wm.getWindow("Config/StarsVisible").setSelected(settings.show_stars_during_icon_view) wm.getWindow("Config/ShowFps").setSelected(settings.show_fps) wm.getWindow("Config/ShowIntro").setSelected(settings.show_intro) helpers.toggleWindow("Config", True) helpers.toggleWindow("Sound", False) helpers.toggleWindow("Graphics", False)
def __init__(self, parent, window): self.parent = parent self.menu = helpers.loadWindowLayout("menu.layout") window.addChildWindow(self.menu) helpers.bindButtonEvent("Menu/Main", self, "onQuitToMain") helpers.bindButtonEvent("Menu/Desktop", self, "onQuitToDesktop") helpers.bindButtonEvent("Menu/Back", self, "onBack") helpers.bindButtonEvent("Menu/Config", self, "onConfig") helpers.toggleWindow("Menu", True).activate()
def _createScene(self): """Setup CEGUI and create the various scenes""" # Initialise CEGUI Renderer self.guiRenderer = cegui.OgreCEGUIRenderer(self.renderWindow, ogre.RENDER_QUEUE_OVERLAY, True, 0, self.sceneManager) self.guiSystem = cegui.System(self.guiRenderer) cegui.Logger.getSingleton().loggingLevel = cegui.Insane # Load Cegui Scheme cegui.ImagesetManager.getSingleton().createImageset( "controls.imageset") cegui.SchemeManager.getSingleton().loadScheme("SleekSpace.scheme") self.guiSystem.setDefaultMouseCursor("SleekSpace", "MouseArrow") wmgr = cegui.WindowManager.getSingleton() root = helpers.loadWindowLayout("battleviewer.layout") self.guiSystem.setGUISheet(root) # Bind events to their respective buttons and set up other misc GUI stuff self.gfl = GUIFadeListener() ogre_root = ogre.Root.getSingleton() ogre_root.addFrameListener(self.gfl) helpers.bindEvent("Controls/Next", self, "next_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Prev", self, "prev_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Beginning", self, "beginning_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/End", self, "end_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Stop", self, "stop_prog", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Play", self, "start_prog", cegui.Window.EventMouseButtonDown) self.gfl.registerElement("Controls") self.gfl.registerElement("Logs", 0.01, 3) self.battlescene = BattleScene(self, self.sceneManager).initial( self.battle.sides) self.rounds = self.battle.rounds self.queue_round() self.roundtimer = ogre.Timer() self.changeScene(self.battlescene) self.guiSystem.injectMousePosition(0, 0)
def _createScene(self): """Setup CEGUI and create the various scenes""" # Initialise CEGUI Renderer self.guiRenderer = cegui.OgreCEGUIRenderer( self.renderWindow, ogre.RENDER_QUEUE_OVERLAY, True, 0, self.sceneManager ) self.guiSystem = cegui.System(self.guiRenderer) cegui.Logger.getSingleton().loggingLevel = cegui.Insane # Load Cegui Scheme cegui.ImagesetManager.getSingleton().createImageset("controls.imageset") cegui.SchemeManager.getSingleton().loadScheme("SleekSpace.scheme") self.guiSystem.setDefaultMouseCursor("SleekSpace", "MouseArrow") wmgr = cegui.WindowManager.getSingleton() root = helpers.loadWindowLayout("battleviewer.layout") self.guiSystem.setGUISheet(root) # Bind events to their respective buttons and set up other misc GUI stuff self.gfl = GUIFadeListener() ogre_root = ogre.Root.getSingleton() ogre_root.addFrameListener(self.gfl) helpers.bindEvent("Controls/Next", self, "next_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Prev", self, "prev_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Beginning", self, "beginning_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/End", self, "end_round", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Stop", self, "stop_prog", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Controls/Play", self, "start_prog", cegui.Window.EventMouseButtonDown) self.gfl.registerElement("Controls") self.gfl.registerElement("Logs", 0.01, 3) self.battlescene = BattleScene(self, self.sceneManager).initial(self.battle.sides) self.rounds = self.battle.rounds self.queue_round() self.roundtimer = ogre.Timer() self.changeScene(self.battlescene) self.guiSystem.injectMousePosition(0, 0)
def createGui(self): system = helpers.loadWindowLayout("system.layout") self.guiSystem.getGUISheet().addChildWindow(system) self.windows = [system] self.system = system helpers.bindButtonEvent("TopBar/MenuButton", self, "toggleMainMenu") helpers.bindButtonEvent("Windows/EndTurnButton", self, "requestEOT") helpers.bindEvent("Navigation/ZoomIn", self.starmap, "zoomIn", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/ZoomOut", self.starmap, "zoomOut", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/Deselect", self, "unselect", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/Center", self, "focus", cegui.Window.EventMouseButtonDown) helpers.bindEvent("Navigation/Autofit", self.starmap, "autofit", cegui.Window.EventMouseButtonDown) self.message_window = gui.MessageWindow(self) self.design_window = gui.DesignsWindow(self) self.info_window = gui.InformationWindow(self) self.system_window = gui.SystemWindow(self) self.orders_window = gui.OrdersWindow(self) self.sub_windows = [ self.message_window, self.design_window, self.info_window, self.system_window, self.orders_window, ] wm = cegui.WindowManager.getSingleton() self.orders_menu = overlay.RadialMenu(self.camera) wm.getWindow("Starmap").addChildWindow(self.orders_menu.menu) self.information_overlay = overlay.InformationOverlay() wm.getWindow("Starmap").addChildWindow( self.information_overlay.overlay)