示例#1
0
    def __init__(self, sceneManager, address, port, player_name):
        # Initialize the various listener classes we are a subclass from
        ogre.FrameListener.__init__(self)
        ogre.WindowEventListener.__init__(self)
        SchedulerManager.__init__(self)
        
        self.address = address
        self.port = port
        self.player_name = player_name
        self.is_round_active = False
        
        self.renderWindow = ogre.Root.getSingleton().getAutoCreatedWindow()
        self.sceneManager = sceneManager
        self.camera = self.sceneManager.getCamera("PrimaryCamera")
        self.cameraNode = self.sceneManager.getSceneNode("PrimaryCamera")
        
        self.viewport = self.camera.getViewport()
        
        self.player = None
        self.last_update = None
        self.scores = { }
        self.scores_changed = Event()
        self.game_nodes = { }
        self.players = { }
        
        # Come up with a non-static way of doing this.
        self.nodes = []
        nodes.Node.node_created += self.on_node_created
        nodes.Node.node_destroyed += self.on_node_destroyed
        
        # Set up the scene.
        self.setupScene()
        
        # Load sounds.
        self.loadSceneSounds()
        
        # Set up the GUI.
        self.gui = PlaySceneGUI(self)
        self.gui.element_selected += self.on_gui_element_selected
        
        # Show a welcome message.
        self.gui.message.notice("Tides of the Elements")
        
        # Load scene music
        audio.set_background_music("media/sounds/Dispatches+Of+Humanity.wav")
        
        # Set up the input devices.
        self.setupInput()

        # Set up initial window size.
        self.windowResized(self.renderWindow)

        # Set this to True when we get an event to exit the application
        self.quit = False

        # Listen for any events directed to the window manager's close button
        ogre.WindowEventUtilities.addWindowEventListener(self.renderWindow, self)
        
        # Begin scene music
        audio.play_background_music()
示例#2
0
    def __init__(self, sceneManager):
        # Initialize the various listener classes we are a subclass from
        ogre.FrameListener.__init__(self)
        ogre.WindowEventListener.__init__(self)

        self.renderWindow = ogre.Root.getSingleton().getAutoCreatedWindow()
        self.sceneManager = sceneManager
        self.camera = self.sceneManager.getCamera("PrimaryCamera")
        self.cameraNode = self.sceneManager.getSceneNode("PrimaryCamera")

        self.viewport = self.camera.getViewport()

        # Create an empty list of nodes
        self.nodes = []

        # Create an empty list of GUI elements.
        self.gui_elements = []

        # Set up the overlay for the GUI.
        self.setupOverlay()

        # Set up the scene.
        self.setupScene()

        # Load sounds.
        self.loadSceneSounds()

        # Set up the GUI.
        self.setupGUI()

        # Show a welcome message.
        self.message.notice("Tides of the Elements")

        # Load scene music
        audio.set_background_music("media/sounds/Dispatches+Of+Humanity.wav")

        # Set up the input devices.
        self.setupInput()

        # Set up initial window size.
        self.windowResized(self.renderWindow)

        # Set this to True when we get an event to exit the application
        self.quit = False

        # Listen for any events directed to the window manager's close button
        ogre.WindowEventUtilities.addWindowEventListener(
            self.renderWindow, self)

        # Begin scene music
        audio.play_background_music()
示例#3
0
文件: playscene.py 项目: parshap/tote
    def __init__(self, sceneManager):
        # Initialize the various listener classes we are a subclass from
        ogre.FrameListener.__init__(self)
        ogre.WindowEventListener.__init__(self)

        self.renderWindow = ogre.Root.getSingleton().getAutoCreatedWindow()
        self.sceneManager = sceneManager
        self.camera = self.sceneManager.getCamera("PrimaryCamera")
        self.cameraNode = self.sceneManager.getSceneNode("PrimaryCamera")

        self.viewport = self.camera.getViewport()

        # Create an empty list of nodes
        self.nodes = []

        # Create an empty list of GUI elements.
        self.gui_elements = []

        # Set up the overlay for the GUI.
        self.setupOverlay()

        # Set up the scene.
        self.setupScene()

        # Load sounds.
        self.loadSceneSounds()

        # Set up the GUI.
        self.setupGUI()

        # Show a welcome message.
        self.message.notice("Tides of the Elements")

        # Load scene music
        audio.set_background_music("media/sounds/Dispatches+Of+Humanity.wav")

        # Set up the input devices.
        self.setupInput()

        # Set up initial window size.
        self.windowResized(self.renderWindow)

        # Set this to True when we get an event to exit the application
        self.quit = False

        # Listen for any events directed to the window manager's close button
        ogre.WindowEventUtilities.addWindowEventListener(self.renderWindow, self)

        # Begin scene music
        audio.play_background_music()