def set(self, pipe, width, height, fullscreen, embedded):
     self.notify.debugStateCall(self)
     state = False
     self.notify.info('SET')
     if self.restrict_to_embedded:
         fullscreen = 0
         embedded = 1
     if embedded:
         if base.appRunner.windowProperties:
             width = base.appRunner.windowProperties.getXSize()
             height = base.appRunner.windowProperties.getYSize()
     self.current_pipe = base.pipe
     self.current_properties = WindowProperties(base.win.getProperties())
     properties = self.current_properties
     self.notify.debug('DISPLAY PREVIOUS:')
     self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
     self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
     self.notify.debug('  X SIZE:     %s' % properties.getXSize())
     self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
     self.notify.debug('DISPLAY REQUESTED:')
     self.notify.debug('  EMBEDDED:   %s' % bool(embedded))
     self.notify.debug('  FULLSCREEN: %s' % bool(fullscreen))
     self.notify.debug('  X SIZE:     %s' % width)
     self.notify.debug('  Y SIZE:     %s' % height)
     if self.current_pipe == pipe and bool(self.current_properties.getParentWindow()) == bool(embedded) and self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height:
         self.notify.info('DISPLAY NO CHANGE REQUIRED')
         state = True
     else:
         properties = WindowProperties()
         properties.setSize(width, height)
         properties.setFullscreen(fullscreen)
         properties.setParentWindow(0)
         if embedded:
             if base.appRunner.windowProperties:
                 properties = base.appRunner.windowProperties
         original_sort = base.win.getSort()
         if self.resetWindowProperties(pipe, properties):
             self.notify.debug('DISPLAY CHANGE SET')
             properties = base.win.getProperties()
             self.notify.debug('DISPLAY ACHIEVED:')
             self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
             self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
             self.notify.debug('  X SIZE:     %s' % properties.getXSize())
             self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
             if bool(properties.getParentWindow()) == bool(embedded) and properties.getFullscreen() == fullscreen and properties.getXSize() == width and properties.getYSize() == height:
                 self.notify.info('DISPLAY CHANGE VERIFIED')
                 state = True
             else:
                 self.notify.warning('DISPLAY CHANGE FAILED, RESTORING PREVIOUS DISPLAY')
                 self.restoreWindowProperties()
         else:
             self.notify.warning('DISPLAY CHANGE FAILED')
             self.notify.warning('DISPLAY SET - BEFORE RESTORE')
             self.restoreWindowProperties()
             self.notify.warning('DISPLAY SET - AFTER RESTORE')
         base.win.setSort(original_sort)
         base.graphicsEngine.renderFrame()
         base.graphicsEngine.renderFrame()
     return state
 def set(self, pipe, width, height, fullscreen, embedded):
     self.notify.debugStateCall(self)
     state = False
     self.notify.info('SET')
     if self.restrict_to_embedded:
         fullscreen = 0
         embedded = 1
     if embedded:
         if base.appRunner.windowProperties:
             width = base.appRunner.windowProperties.getXSize()
             height = base.appRunner.windowProperties.getYSize()
     self.current_pipe = base.pipe
     self.current_properties = WindowProperties(base.win.getProperties())
     properties = self.current_properties
     self.notify.debug('DISPLAY PREVIOUS:')
     self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
     self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
     self.notify.debug('  X SIZE:     %s' % properties.getXSize())
     self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
     self.notify.debug('DISPLAY REQUESTED:')
     self.notify.debug('  EMBEDDED:   %s' % bool(embedded))
     self.notify.debug('  FULLSCREEN: %s' % bool(fullscreen))
     self.notify.debug('  X SIZE:     %s' % width)
     self.notify.debug('  Y SIZE:     %s' % height)
     if self.current_pipe == pipe and bool(self.current_properties.getParentWindow()) == bool(embedded) and self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height:
         self.notify.info('DISPLAY NO CHANGE REQUIRED')
         state = True
     else:
         properties = WindowProperties()
         properties.setSize(width, height)
         properties.setFullscreen(fullscreen)
         properties.setParentWindow(0)
         if embedded:
             if base.appRunner.windowProperties:
                 properties = base.appRunner.windowProperties
         original_sort = base.win.getSort()
         if self.resetWindowProperties(pipe, properties):
             self.notify.debug('DISPLAY CHANGE SET')
             properties = base.win.getProperties()
             self.notify.debug('DISPLAY ACHIEVED:')
             self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
             self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
             self.notify.debug('  X SIZE:     %s' % properties.getXSize())
             self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
             if bool(properties.getParentWindow()) == bool(embedded) and properties.getFullscreen() == fullscreen and properties.getXSize() == width and properties.getYSize() == height:
                 self.notify.info('DISPLAY CHANGE VERIFIED')
                 state = True
             else:
                 self.notify.warning('DISPLAY CHANGE FAILED, RESTORING PREVIOUS DISPLAY')
                 self.restoreWindowProperties()
         else:
             self.notify.warning('DISPLAY CHANGE FAILED')
             self.notify.warning('DISPLAY SET - BEFORE RESTORE')
             self.restoreWindowProperties()
             self.notify.warning('DISPLAY SET - AFTER RESTORE')
         base.win.setSort(original_sort)
         base.graphicsEngine.renderFrame()
         base.graphicsEngine.renderFrame()
     return state
예제 #3
0
 def setFullscreen(self, settings):
     """Set the window to fullscreen or windowed mode depending on the
     configuration in the settings variable"""
     props = WindowProperties()
     props.setFullscreen(settings.fullscreen)
     props.setUndecorated(settings.fullscreen)
     if settings.fullscreen:
         props.setSize(settings.windowSize[0], settings.windowSize[1])
     base.win.requestProperties(props)
     base.taskMgr.step()
예제 #4
0
 def fullscreen(self):
     '''
     Witch between Fullscreen and window mode
     '''
     self._conf.fullscreen = not self._conf.fullscreen
     wp = WindowProperties()
     wp.setFullscreen(self._conf.fullscreen)
     wp.setOrigin(0, 0)
     wp.setSize(int(base.pipe.getDisplayWidth()),
                int(base.pipe.getDisplayHeight()))
     base.win.requestProperties(wp)
     self.option()
예제 #5
0
	def makeGameEngine(self):
		''' Creates a new game engine based on settings in GameSettings.
			Information for this came from here
			http://panda3d.org/phpbb2/viewtopic.php?t=2848'''
		
		LOG.debug("[GXMgr] Building game engine")
		
		# Temporary
		# TODO: Fix this
		props = WindowProperties()
		props.setFullscreen(False) 
		props.setUndecorated(False) 
		#screenx = int(base.pipe.getDisplayWidth()/2) - (int(self.ScreenWidth)/2)
		#screeny = int(base.pipe.getDisplayHeight()/2) - (int(self.ScreenHeight)/2) 
		#self.TempScreenSizeRX = int(self.ScreenWidth) 
		#self.TempScreenSizeRY = int(self.ScreenHeight) 
		props.setOrigin(100,100) 
		props.setSize(1024,768) 
		base.win.requestProperties(props) 
		
		# This was the old way that no longer works - I don't know why
		## Create a new FrameBufferProperties object using our settings
		#fbProps = FrameBufferProperties()
		#fbProps.addProperties(FrameBufferProperties.getDefault())
		#fbProps.setMultisamples(GameSettings().antiAlias)
		#fbProps.setAlphaBits(GameSettings().alphaBits)
		#fbProps.setDepthBits(GameSettings().colorDepth)
		#fbProps.setColorBits(24)
		#
		## Create a WindowProperties object
		#winProps = WindowProperties( base.win.getProperties() )
		#winProps.setFullscreen(GameSettings().fullscreen)
		#winProps.setUndecorated(GameSettings().fullscreen)
		#winProps.setSize(GameSettings().xRes,GameSettings().yRes)
		#winProps.setTitle('PSG - Project Space Game: Alpha')
		#
		## Create the engine
		#base.graphicsEngine.makeOutput(base.pipe,  # GraphicsPipe
		#						'mainGameOutput',  # Name
		#						0,                 # Sort
		#						fbProps,           # FrameBufferProperties
		#						winProps,          # WindowProperties
		#						GraphicsPipe.BFRequireWindow | GraphicsPipe.BFFbPropsOptional, # Flags
		#						base.win.getGsg()) # GraphicsStateGaurdian
		##base.openMainWindow(props=winProps, gsg=base.win.getGsg(), keepCamera=1)
		#base.openMainWindow()
		#base.graphicsEngine.openWindows()
		#base.win.requestProperties(winProps)
		## The following code should proabably be moved somewhere else
		#showFPS = GameSettings().showFPS
		#base.setFrameRateMeter(showFPS)
		
예제 #6
0
파일: settings.py 프로젝트: hlysig/O3
    def click_ok_button(self):
        if self.new_screen_resolution:
            wp = WindowProperties()
            wp.setSize(self.new_screen_resolution[0],
                       self.new_screen_resolution[1])
            base.win.requestProperties(wp)

        if self.new_screen_fullscreen is not None:
            wp = WindowProperties()
            wp.setFullscreen(self.new_screen_fullscreen)
            base.win.requestProperties(wp)

        self.np.remove()
        messenger.send('dialog_closing')
예제 #7
0
 def setFullscreen():
     """Helper function to set the window fullscreen
     with width and height set to the screens size"""
     # get the displays width and height
     w = self.pipe.getDisplayWidth()
     h = self.pipe.getDisplayHeight()
     # set window properties
     # clear all properties not previously set
     base.win.clearRejectedProperties()
     # setup new window properties
     props = WindowProperties()
     # Fullscreen
     props.setFullscreen(True)
     # set the window size to the screen resolution
     props.setSize(w, h)
     # request the new properties
     base.win.requestProperties(props)
예제 #8
0
    def toggleFullScreen(self):
        # If there is an open dialog, then this function
        # will not execute.
        if dialogService.hasOpenDialog():
            return

        wp = WindowProperties()

        if not browser_config['fullscreen']:
            wp.setSize(base.win.getXSize(), base.win.getYSize())
            wp.setFullscreen(True)
            base.win.requestProperties(wp)
            browser_config['fullscreen'] = True

        else:
            wp.setSize(base.win.getXSize(), base.win.getYSize())
            wp.setFullscreen(False)
            base.win.requestProperties(wp)
            browser_config['fullscreen'] = False
예제 #9
0
파일: Engine.py 프로젝트: czorn/Modifire
 def ToggleFullScreen(self):
     fullscreen = not base.win.isFullscreen()
     props = WindowProperties( base.win.getProperties() )
     
     if(not fullscreen):
         props.setFullscreen(False)
         props.setSize(850, 480)
     
     else:
         props.setFullscreen(True)
         w = base.pipe.getDisplayWidth()
         h = base.pipe.getDisplayHeight()
         if w and h:
             props.setSize(w,h)
         else:
             props.setSize(850, 480)
     
     base.win.requestProperties(props)
             
     messenger.send('window-event',[base.win])
예제 #10
0
    def setupWindow(self, windowType, x, y, width, height,
                    parent):
        """ Applies the indicated window parameters to the prc
        settings, for future windows; or applies them directly to the
        main window if the window has already been opened.  This is
        called by the browser. """

        if self.started and base.win:
            # If we've already got a window, this must be a
            # resize/reposition request.
            wp = WindowProperties()
            if x or y or windowType == 'embedded':
                wp.setOrigin(x, y)
            if width or height:
                wp.setSize(width, height)
            if windowType == 'embedded':
                wp.setParentWindow(parent)
            wp.setFullscreen(False)
            base.win.requestProperties(wp)
            self.windowProperties = wp
            return

        # If we haven't got a window already, start 'er up.  Apply the
        # requested setting to the prc file, and to the default
        # WindowProperties structure.

        self.__clearWindowProperties()

        if windowType == 'hidden':
            data = 'window-type none\n'
        else:
            data = 'window-type onscreen\n'

        wp = WindowProperties.getDefault()

        wp.clearParentWindow()
        wp.clearOrigin()
        wp.clearSize()

        wp.setFullscreen(False)
        if windowType == 'fullscreen':
            wp.setFullscreen(True)

        if windowType == 'embedded':
            wp.setParentWindow(parent)

        if x or y or windowType == 'embedded':
            wp.setOrigin(x, y)

        if width or height:
            wp.setSize(width, height)

        self.windowProperties = wp
        self.windowPrc = loadPrcFileData("setupWindow", data)
        WindowProperties.setDefault(wp)

        self.gotWindow = True

        # Send this call to the main thread; don't call it directly.
        messenger.send('AppRunner_startIfReady', taskChain = 'default')
예제 #11
0
    def setupWindow(self, windowType, x, y, width, height, parent):
        """ Applies the indicated window parameters to the prc
        settings, for future windows; or applies them directly to the
        main window if the window has already been opened.  This is
        called by the browser. """

        if self.started and base.win:
            # If we've already got a window, this must be a
            # resize/reposition request.
            wp = WindowProperties()
            if x or y or windowType == 'embedded':
                wp.setOrigin(x, y)
            if width or height:
                wp.setSize(width, height)
            if windowType == 'embedded':
                wp.setParentWindow(parent)
            wp.setFullscreen(False)
            base.win.requestProperties(wp)
            self.windowProperties = wp
            return

        # If we haven't got a window already, start 'er up.  Apply the
        # requested setting to the prc file, and to the default
        # WindowProperties structure.

        self.__clearWindowProperties()

        if windowType == 'hidden':
            data = 'window-type none\n'
        else:
            data = 'window-type onscreen\n'

        wp = WindowProperties.getDefault()

        wp.clearParentWindow()
        wp.clearOrigin()
        wp.clearSize()

        wp.setFullscreen(False)
        if windowType == 'fullscreen':
            wp.setFullscreen(True)

        if windowType == 'embedded':
            wp.setParentWindow(parent)

        if x or y or windowType == 'embedded':
            wp.setOrigin(x, y)

        if width or height:
            wp.setSize(width, height)

        self.windowProperties = wp
        self.windowPrc = loadPrcFileData("setupWindow", data)
        WindowProperties.setDefault(wp)

        self.gotWindow = True

        # Send this call to the main thread; don't call it directly.
        messenger.send('AppRunner_startIfReady', taskChain='default')
예제 #12
0
    def set(self, pipe, width, height, fullscreen, embedded):
        self.notify.debugStateCall(self)
        state = False

        self.notify.info("SET")

        #fullscreen = options.fullscreen_runtime
        #embedded = options.embedded_runtime
        if self.restrict_to_embedded:
            fullscreen = 0
            embedded = 1

        if embedded:
            if base.appRunner.windowProperties:
                width = base.appRunner.windowProperties.getXSize()
                height = base.appRunner.windowProperties.getYSize()

        self.current_pipe = base.pipe
        self.current_properties = WindowProperties(base.win.getProperties())

        properties = self.current_properties
        self.notify.debug("DISPLAY PREVIOUS:")
        self.notify.debug("  EMBEDDED:   %s" %
                          bool(properties.getParentWindow()))
        self.notify.debug("  FULLSCREEN: %s" %
                          bool(properties.getFullscreen()))
        self.notify.debug("  X SIZE:     %s" % properties.getXSize())
        self.notify.debug("  Y SIZE:     %s" % properties.getYSize())
        self.notify.debug("DISPLAY REQUESTED:")
        self.notify.debug("  EMBEDDED:   %s" % bool(embedded))
        self.notify.debug("  FULLSCREEN: %s" % bool(fullscreen))
        self.notify.debug("  X SIZE:     %s" % width)
        self.notify.debug("  Y SIZE:     %s" % height)

        if ((self.current_pipe == pipe) and \
            (bool(self.current_properties.getParentWindow( )) == bool(embedded)) and \
            (self.current_properties.getFullscreen ( ) == fullscreen) and \
            (self.current_properties.getXSize ( ) == width) and \
            (self.current_properties.getYSize ( ) == height)):
            # no display change required
            self.notify.info("DISPLAY NO CHANGE REQUIRED")
            state = True
        else:
            properties = WindowProperties()
            properties.setSize(width, height)
            properties.setFullscreen(fullscreen)
            properties.setParentWindow(0)

            if embedded:
                if base.appRunner.windowProperties:
                    properties = base.appRunner.windowProperties

            # get current sort order
            original_sort = base.win.getSort()

            if self.resetWindowProperties(pipe, properties):
                self.notify.debug("DISPLAY CHANGE SET")

                # verify display change
                properties = base.win.getProperties()

                self.notify.debug("DISPLAY ACHIEVED:")
                self.notify.debug("  EMBEDDED:   %s" %
                                  bool(properties.getParentWindow()))
                self.notify.debug("  FULLSCREEN: %s" %
                                  bool(properties.getFullscreen()))
                self.notify.debug("  X SIZE:     %s" % properties.getXSize())
                self.notify.debug("  Y SIZE:     %s" % properties.getYSize())

                if ((bool(properties.getParentWindow( )) == bool(embedded)) and \
                    (properties.getFullscreen ( ) == fullscreen) and \
                    (properties.getXSize ( ) == width) and \
                    (properties.getYSize ( ) == height)):
                    self.notify.info("DISPLAY CHANGE VERIFIED")
                    state = True
                else:
                    self.notify.warning(
                        "DISPLAY CHANGE FAILED, RESTORING PREVIOUS DISPLAY")
                    self.restoreWindowProperties()
            else:
                self.notify.warning("DISPLAY CHANGE FAILED")
                self.notify.warning("DISPLAY SET - BEFORE RESTORE")
                self.restoreWindowProperties()
                self.notify.warning("DISPLAY SET - AFTER RESTORE")

            # set current sort order
            base.win.setSort(original_sort)

            base.graphicsEngine.renderFrame()
            base.graphicsEngine.renderFrame()

        return state
def toggleFullscreen():
	wp = WindowProperties()
	wp.setFullscreen(not base.win.isFullscreen())
	base.win.requestProperties(wp)
def setResolution(x=800, y=600, fullScreen=False):
    wp = WindowProperties()
    wp.setSize(x, y)
    wp.setFullscreen(fullScreen)
    base.win.requestProperties(wp)
예제 #15
0
파일: main.py 프로젝트: JohnBish/NSD
class NSDApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        self.keys = ReadKeys()

        self.wp = WindowProperties()
        self.wp.setFullscreen(1)
        self.wp.setSize(RESOLUTION)
        self.openMainWindow()
        self.win.requestProperties(self.wp)
        self.graphicsEngine.openWindows()
        self.setBackgroundColor(0, 0, 0)
        self.disableMouse()
        self.props = WindowProperties()
        self.props.setCursorHidden(True)
        self.win.requestProperties(self.props)
        self.title()

    def title(self):
        #Removes title and loads current room
        def destroyTitle(task):
            card.removeNode()
            startGame()

        def startGame():
            if os.path.isfile('saves/location.json'):
                self.directToRoom()
            else:
                self.homeFirst()

        #Loads title animation
        titleText = self.loader.loadTexture('resources/titleText.avi')
        titleText.setLoopCount(1)
        titleText.play()

        #Displays title
        cm = CardMaker('titleText')
        cm.setFrameFullscreenQuad()
        cm.setUvRange(titleText)
        # noinspection PyArgumentList
        card = NodePath(cm.generate())
        card.reparentTo(self.render2d)
        card.setTexture(titleText)
        self.taskMgr.doMethodLater(5.6, destroyTitle, 'endTitle')

    def saveRoom(self, cr):
        with open('saves/location.json', 'w+') as outfile:
            saveInfo = {'currentRoom': cr}
            json.dump(saveInfo,
                      outfile,
                      sort_keys=True,
                      indent=4,
                      ensure_ascii=False)

    def directToRoom(self):
        with open('saves/location.json') as df:
            data = json.load(df)

    def homeFirst(self):
        self.homeRoom()

    def homeRoom(self):
        self.saveRoom("1")
예제 #16
0
def setResolution(x=800, y=600, fullScreen=False):
	wp = WindowProperties()
	wp.setSize(x,y)
	wp.setFullscreen(fullScreen)
	base.win.requestProperties(wp)
예제 #17
0
파일: Runner.py 프로젝트: hlysig/O3
    base.setBackgroundColor(_background_color)

    # Check if we have any screen resolution in our configuration file, if not we use default.
    (sx, sy) = DEFAULT_RESOLUTION.split('x')

    if 'screen_resolution' in browser_config.getConfigKeys():
        resValue = browser_config.getValue('screen_resolution')
        (sx, sy) = (int(resValue.split('x')[0]), int(resValue.split('x')[1]))
    #
    ## Set the screen resolution.
    wp = WindowProperties()

    # Check if we have any fullscreen mode in the configuration.
    _fullscreen = DEFAULT_FULLSCREEN
    if 'fullscreen' in browser_config.getConfigKeys():
        _fullscreen = bool(int(browser_config['fullscreen']))

    wp.setFullscreen(_fullscreen)
    wp.setSize(int(sx), int(sy))
    base.win.requestProperties(wp)

    # Disable panda3d mouse handler.
    base.disableMouse()

    # Initialize the browser in cubemode.
    photocube.modes.cubeMode.enable()

    # Start Panda3D event loop.
    run()
예제 #18
0
 def _setresolution(res, fullscreen=False):
     wp = WindowProperties()
     wp.setSize(int(res[0]), int(res[1]))
     wp.setFullscreen(fullscreen)
     base.win.requestProperties(wp)
예제 #19
0
 def set_fullscreen(self):
     winProps = WindowProperties()
     self.isFullscreen = not self.isFullscreen
     winProps.setFullscreen(self.isFullscreen)
     self.win.requestProperties(winProps)
예제 #20
0
 def toggleFullscreen(self):
     props = WindowProperties()
     props.setFullscreen(not base.win.getProperties().getFullscreen())
     base.win.requestProperties(props)