当前位置: 首页>>代码示例>>Python>>正文


Python WindowProperties.setFullscreen方法代码示例

本文整理汇总了Python中panda3d.core.WindowProperties.setFullscreen方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.setFullscreen方法的具体用法?Python WindowProperties.setFullscreen怎么用?Python WindowProperties.setFullscreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.WindowProperties的用法示例。


在下文中一共展示了WindowProperties.setFullscreen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setupWindow

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
 def setupWindow(self):
     wp = WindowProperties()
     wp.setFullscreen(settings.FULLSCREEN)
     wp.setSize(settings.WIDTH, settings.HEIGHT)
     wp.setTitle("GAME")
     base.win.requestProperties(wp)
     base.win.setClearColor(Vec4(0.5, 0.5, 0.8, 1))
开发者ID:genusgant,项目名称:Panda3d-TowerDefense_Game,代码行数:9,代码来源:main.py

示例2: __init__

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
 def __init__(self):
    DirectObject.__init__(self)
    self.close=lambda:None
    #create main window
    base=ShowBase()
    __builtin__.base=base
    props = WindowProperties()
    #props.setTitle(ConfigVariableString('win-title').getValue()) 
    props.setFullscreen(ConfigVariableBool('fullscreen').getValue())
    props.setSize(ConfigVariableInt('win-width').getValue(),ConfigVariableInt('win-height').getValue())
    base.win.requestProperties(props)
    self.width=base.win.getXSize() 
    self.height=base.win.getYSize()
    print 'size=',self.width,'x',self.height
    self.accept('window-event',self.on_resize)
    base.disableMouse()
    #set fps limit
    globalClock=ClockObject.getGlobalClock() 
    globalClock.setMode(ClockObject.MLimited) 
    globalClock.setFrameRate(ConfigVariableDouble('clock-frame-rate').getValue())
    __builtin__.screen=self
    __builtin__.gui=pixel2d.attachNewNode('Screen.gui')
    #gui is the node for 2d rendering, scaled to the screen resolution,
    #with origin at bottom-left, and max at top-right
    gui.setZ(gui,-self.height)
    __builtin__.console=Console(print_messenger_events=False)
    __builtin__.out=console.out
    console.request('Open')
    __builtin__.mouse=base.pointerWatcherNodes[0]
    #is used as a stack. stores frames showed to the user (top at the front of the screen)
    self.frames=[]
开发者ID:onze,项目名称:goLive,代码行数:33,代码来源:screen.py

示例3: toggle_fullscreen

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
 def toggle_fullscreen(self):
     wp = WindowProperties()
     self.isFullScreen = not self.isFullScreen
     wp.setFullscreen(self.isFullScreen)
     wp.setSize(1024, 768)
     base.openMainWindow()
     base.win.requestProperties(wp)
     base.graphicsEngine.openWindows()
开发者ID:felipesanches,项目名称:MAME_3D_models,代码行数:10,代码来源:main.py

示例4: toggle_fullscreen

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
 def toggle_fullscreen(self):
     """ Toggles fullscreen mode."""
     props = WindowProperties(self.win.getProperties())
     if props.getFullscreen():
         props.setSize(*self.size)
         props.setFullscreen(False)
     else:
         w = self.pipe.getDisplayWidth()
         h = self.pipe.getDisplayHeight()
         props.setSize(w, h)
         props.setFullscreen(True)
     self.win.requestProperties(props)
开发者ID:wanweiwei07,项目名称:pyhiro,代码行数:14,代码来源:pandabase.py

示例5: main

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
def main():
	props = WindowProperties( )

	props.setTitle( 'El Juego Loco' )
	props.setCursorFilename(Filename.binaryFilename("cursor.ico"))
	props.setFullscreen(0)
	props.setSize(1024, 768)

	game = World()

	game.win.setClearColor((0, 0, 0, 1))
	game.win.requestProperties( props )
	game.setFrameRateMeter(True)

	game.run()
开发者ID:JauriaStudios,项目名称:pandasandbox,代码行数:17,代码来源:main.py

示例6: toggleFullScreen

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
 def toggleFullScreen(self):
     props = WindowProperties( self.win.getProperties() )
     if not props.getFullscreen():
         props.setSize(int(game_settings['screen_resolution'][0]),int(game_settings['screen_resolution'][1]))
         props.setFullscreen(True)
     else:
         props.setFullscreen(False)
     self.win.requestProperties(props)
     
     game_settings['full_screen'] = not game_settings['full_screen']
     
     if self.configForm:
         self.configForm.refreshSettings()
         
     messenger.send('window-event', [self])
开发者ID:WindyDarian,项目名称:Sogal,代码行数:17,代码来源:sogal_base.py

示例7: _applyScreenResolution

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
 def _applyScreenResolution(self):
     
     props = WindowProperties( self.win.getProperties() )
     if not props.getFullscreen:
         props.setSize(int(game_settings['screen_resolution'][0]),int(game_settings['screen_resolution'][1]))
         props.setFullscreen(game_settings['full_screen'])
     else:
         props.setFullscreen(game_settings['full_screen'])
         props.setSize(int(game_settings['screen_resolution'][0]),int(game_settings['screen_resolution'][1]))
         
     self.win.requestProperties(props)
     
     if self.configForm:
         self.configForm.refreshSettings()
         
     messenger.send('window-event', [self])
开发者ID:WindyDarian,项目名称:Sogal,代码行数:18,代码来源:sogal_base.py

示例8: main

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
def main():

    props = WindowProperties( )

    props.setTitle('Hostil Galaxy')
    props.setCursorFilename(Filename.binaryFilename('cursor.ico'))
    props.setCursorHidden(False)
    props.setFullscreen(False)
    props.setSize(800, 600)

    game = World()

    game.win.setClearColor((0, 0, 0, 1))
    game.win.requestProperties(props)
    game.setFrameRateMeter(True)

    game.run()
开发者ID:TheCheapestPixels,项目名称:HostilGalaxy,代码行数:19,代码来源:main.py

示例9: toggleFullscreen

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
    def toggleFullscreen(self):
        prop = base.win.getProperties()
        newProp = WindowProperties()

        if not prop.getFullscreen():
            newProp.setFullscreen(True)
            # Quick hack to get it to select a suitable display mode.
            if (1920, 1080) in self.res:
                newProp.setSize(1920, 1080)
            elif (1680, 1050) in self.res:
                newProp.setSize(1680, 1050)
            elif (1280, 768) in self.res:
                newProp.setSize(1280, 768)
            elif (1024, 768) in self.res:
                newProp.setSize(1024, 768)
            else:
                newProp.setSize(800, 600)
        else:
            newProp.setFullscreen(False)

        base.win.requestProperties(newProp)
开发者ID:gamingrobot,项目名称:second-sunrise,代码行数:23,代码来源:window.py

示例10: setupWindow

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
    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')
开发者ID:Just-D,项目名称:panda3d,代码行数:62,代码来源:AppRunner.py

示例11: __init__

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
    def __init__(self):
        ShowBase.__init__(self)
        FSM.__init__(self, "FSM-Game")

        #
        # BASIC APPLICATION CONFIGURATIONS
        #
        self.disableMouse()
        self.setBackgroundColor(0, 0, 0)
        self.camLens.setFov(75)
        self.camLens.setNear(0.8)

        # check if the config file hasn't been created
        base.textWriteSpeed = 0.05
        mute = ConfigVariableBool("audio-mute", False).getValue()
        if mute:
            self.disableAllAudio()
        else:
            self.enableAllAudio()
        particles = ConfigVariableBool("particles-enabled", True).getValue()
        if particles:
            self.enableParticles()
        base.textWriteSpeed = ConfigVariableDouble("text-write-speed",0.05).getValue()
        base.controlType = ConfigVariableString("control-type", "Gamepad").getValue()
        base.mouseSensitivity = ConfigVariableDouble("mouse-sensitivity",1.0).getValue()
        if not os.path.exists(prcFile):
            self.__writeConfig()
            # set window properties
            # clear all properties not previously set
            self.win.clearRejectedProperties()
            # setup new window properties
            props = WindowProperties()
            # Fullscreen
            props.setFullscreen(True)
            # window icon
            print props.hasIconFilename()
            props.setIconFilename(windowicon)
            # get the displays width and height
            w = self.pipe.getDisplayWidth()
            h = self.pipe.getDisplayHeight()
            # set the window size to the screen resolution
            props.setSize(w, h)
            # request the new properties
            self.win.requestProperties(props)
        atexit.register(self.__writeConfig)

        # enable collision handling
        base.cTrav = CollisionTraverser("base collision traverser")
        base.pusher = CollisionHandlerPusher()
        base.pusher.addInPattern('%fn-in-%in')
        base.pusher.addOutPattern('%fn-out-%in')

        self.menu = Menu()
        self.options = OptionsMenu()

        self.musicMenu = loader.loadMusic("MayanJingle6_Menu.ogg")
        self.musicMenu.setLoop(True)

        cm = CardMaker("menuFade")
        cm.setFrameFullscreenQuad()
        self.menuCoverFade = NodePath(cm.generate())
        self.menuCoverFade.setTransparency(TransparencyAttrib.MAlpha)
        self.menuCoverFade.setBin("fixed", 1000)
        self.menuCoverFade.reparentTo(render2d)
        self.menuCoverFade.hide()
        self.menuCoverFadeOutInterval = Sequence(
            Func(self.menuCoverFade.show),
            LerpColorScaleInterval(
                self.menuCoverFade,
                1,
                LVecBase4f(0.0,0.0,0.0,1.0),
                LVecBase4f(0.0,0.0,0.0,0.0)),
            Func(self.menuCoverFade.hide))
        self.menuCoverFadeInInterval = Sequence(
            Func(self.menuCoverFade.show),
            LerpColorScaleInterval(
                self.menuCoverFade,
                1,
                LVecBase4f(0.0,0.0,0.0,0.0),
                LVecBase4f(0.0,0.0,0.0,1.0)),
            Func(self.menuCoverFade.hide))
        self.lerpAudioFadeOut = LerpFunc(
            self.audioFade,
            fromData=1.0,
            toData=0.0,
            duration=0.25,
            extraArgs=[self.musicMenu])
        self.fadeMusicOut = Sequence(
            self.lerpAudioFadeOut,
            Func(self.musicMenu.stop))
        self.lerpAudioFadeIn = LerpFunc(
            self.audioFade,
            fromData=0.0,
            toData=1.0,
            duration=1,
            extraArgs=[self.musicMenu])
        self.fadeMusicIn = Sequence(
                Func(self.musicMenu.play),
                self.lerpAudioFadeIn)

#.........这里部分代码省略.........
开发者ID:grimfang,项目名称:owp_ajaw,代码行数:103,代码来源:main.py

示例12: __init__

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
    def __init__(self):
        """initialise the engine"""
        ShowBase.__init__(self)
        FSM.__init__(self, "FSM-Game")

        #
        # BASIC APPLICATION CONFIGURATIONS
        #
        # disable pandas default camera driver
        self.disableMouse()
        # set background color to black
        self.setBackgroundColor(0, 0, 0)
        # set antialias for the complete sceen to automatic
        self.render.setAntialias(AntialiasAttrib.MAuto)
        # shader generator
        render.setShaderAuto()

        #
        # CONFIGURATION LOADING
        #
        # load given variables or set defaults
        # check if audio should be muted
        mute = ConfigVariableBool("audio-mute", False).getValue()
        if mute:
            self.disableAllAudio()
        else:
            self.enableAllAudio()
        # check if particles should be enabled
        particles = ConfigVariableBool("particles-enabled", True).getValue()
        if particles:
            self.enableParticles()
        # check if the config file hasn't been created
        if not os.path.exists(prcFile):
            # 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)
        elif base.appRunner:
            # As when the application is started as appRunner instance
            # it doesn't respect our loadPrcFile configurations specific
            # to the window, hence we need to manually set them here.
            for dec in range(mainConfig.getNumDeclarations()):
                #TODO: Check for all window specific variables like
                #      fullscreen, screen size, title and window
                #      decoration that you have in your configuration
                #      and set them by your own.
                if mainConfig.getVariableName(dec) == "fullscreen":
                    if not mainConfig.getDeclaration(dec).getBoolWord(0): break
                    # 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)
                    break

        # automatically safe configuration at application exit
        base.exitFunc = self.__writeConfig

        # due to the delayed window resizing and switch to fullscreen
        # we wait some time until everything is set so we can savely
        # proceed with other setups like the menus
        if base.appRunner:
            # this behaviour only happens if run from p3d files and
            # hence the appRunner is enabled
            taskMgr.doMethodLater(0.5, self.postInit,
                "post initialization", extraArgs=[])
        else:
            self.postInit()
开发者ID:jorjuato,项目名称:panda3d-tutorial,代码行数:89,代码来源:main.py

示例13: __init__

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
    def __init__(self):
        ShowBase.__init__(self)

        # self.setFrameRateMeter(True)
        wp = WindowProperties()
        wp.setSize(1280, 720)
        wp.setFullscreen(False)
        self.win.requestProperties(wp)
        self.disableMouse()

        # Load the background starfield.
        self.setBackgroundColor((0, 0, 0, 1))

        self.font = loader.loadFont('textures/inconsolata.egg')

        self.bg = loadObject("star_field.png", scale=73, depth=200,
                             transparency=False)
        self.bg.setTag('back_ground', '1')
        self.bg.setSx(73*16/9)
        # Load the ship and set its initial velocity. Create a ship entity

        self.keys = {   "turnLeft": 0, 
                        "turnRight": 0,
                        "accel": 0, 
                        "fire": 0,
                        "laser": 0,
                        "e_to_s": 0, 
                        "s_to_e": 0,
                        "cloak": 0,
                        "p2turnLeft": 0, 
                        "p2turnRight": 0,
                        "p2accel": 0, 
                        "p2fire": 0,
                        "p2laser": 0,
                        "e_to_s2": 0, 
                        "s_to_e2": 0,
                        "cloak2": 0,
                        "toggle_debug": 0,
                        "e_field": 0,
                        "e_field2": 0,
                        "mouse_l": 0,
                    }

        self.accept("escape", sys.exit)  # Escape quits
        # Other keys events set the appropriate value in our key dictionary
        self.accept("a",     self.setKey, ["turnLeft", 1])
        self.accept("a-up",  self.setKey, ["turnLeft", 0])
        self.accept("d",    self.setKey, ["turnRight", 1])
        self.accept("d-up", self.setKey, ["turnRight", 0])
        self.accept("w",       self.setKey, ["accel", 1])
        self.accept("w-up",    self.setKey, ["accel", 0])
        self.accept("f",       self.setKey, ["fire", 1])
        self.accept("f-up",    self.setKey, ["fire", 0])
        self.accept("h",       self.setKey, ["laser", 1])
        self.accept("h-up",    self.setKey, ["laser", 0])
        self.accept("r",          self.setKey, ["e_to_s", 1])
        self.accept("r-up",          self.setKey, ["e_to_s", 0])
        self.accept("t",          self.setKey, ["s_to_e", 1])
        self.accept("t-up",          self.setKey, ["s_to_e", 0])
        self.accept("s",              self.setKey, ["cloak", 1])
        self.accept("s-up",           self.setKey, ["cloak", 0])
        self.accept("g",              self.setKey, ["e_field", 1])
        self.accept("g-up",           self.setKey, ["e_field", 0])

        self.accept("arrow_left",     self.setKey, ["p2turnLeft", 1])
        self.accept("arrow_left-up",  self.setKey, ["p2turnLeft", 0])
        self.accept("arrow_right",    self.setKey, ["p2turnRight", 1])
        self.accept("arrow_right-up", self.setKey, ["p2turnRight", 0])
        self.accept("arrow_up",       self.setKey, ["p2accel", 1])
        self.accept("arrow_up-up",    self.setKey, ["p2accel", 0])

        # NUMPAD for p2
        self.accept("1",              self.setKey, ["p2fire", 1])
        self.accept("1-up",           self.setKey, ["p2fire", 0])
        self.accept("3",              self.setKey, ["p2laser", 1])
        self.accept("3-up",           self.setKey, ["p2laser", 0])
        self.accept("4",              self.setKey, ["e_to_s2", 1])
        self.accept("4-up",           self.setKey, ["e_to_s2", 0])
        self.accept("5",              self.setKey, ["s_to_e2", 1])
        self.accept("5-up",           self.setKey, ["s_to_e2", 0])
        self.accept("2",              self.setKey, ["e_field2", 1])
        self.accept("2-up",           self.setKey, ["e_field2", 0])
        # NO NUMPAD for p2
        self.accept("l",              self.setKey, ["p2fire", 1])
        self.accept("l-up",           self.setKey, ["p2fire", 0])
        self.accept("'",              self.setKey, ["p2laser", 1])
        self.accept("'-up",           self.setKey, ["p2laser", 0])
        self.accept("o",              self.setKey, ["e_to_s2", 1])
        self.accept("o-up",           self.setKey, ["e_to_s2", 0])
        self.accept("p",              self.setKey, ["s_to_e2", 1])
        self.accept("p-up",           self.setKey, ["s_to_e2", 0])
        self.accept(";",              self.setKey, ["e_field2", 1])
        self.accept(";-up",           self.setKey, ["e_field2", 0])


        self.accept("arrow_down",              self.setKey, ["cloak2", 1])
        self.accept("arrow_down-up",           self.setKey, ["cloak2", 0])

        self.accept("f1",             self.setKey, ["toggle_debug", 1])
        self.accept("mouse1",         self.setKey, ["mouse_l", 1])
#.........这里部分代码省略.........
开发者ID:martinrioux,项目名称:Panda3D-Space-Wars,代码行数:103,代码来源:main.py

示例14: __init__

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
    def __init__(self):
        # this will be in the config file usually
        path_to_models = '../goBananas/'
        # using log.txt in this directory (gobananas), Yummy banana09
        #avatar_head = -23.0306647431 
        #avatar_pos = Point3(-0.499429, 4.01372, 1)
        #banana_pos = Point3(-0.461612, 4.1383, 1)
        #banana_h = 35

        # using giz_bananarchy.txt in this directory Yummy banana4
        avatar_head = 32.6150996909
        avatar_pos = Point3(-2.53202, 3.98558, 1)
        banana_pos = Point3(-2.88193, 4.38051, 1)
        banana_h = -418

        # Things that can affect camera:
        # options resolution resW resH
        base = ShowBase()
        wp = WindowProperties()
        wp.setFullscreen(True)
        base.win.requestProperties(wp)
        lens = PerspectiveLens()
        # Fov is set in config for 60
        lens.setFov(60)
        # aspectratio should be same as window size
        # this was for 800x600
        # field of view 60 46.8264...
        # aspect ratio 1.3333
        #lens.setAspectRatio(800.0 / 600.0)
        lens.setAspectRatio(1024.0 / 768.0)
        base.cam.node().setLens(lens)
        print lens.getFov()
        print lens.getAspectRatio()
        # set near to be same as avatar's radius
        lens.setNear(0.1)
        print 'near camera', lens.getNear()
        #base.cam.setPos(0, 0, 1)
        base.cam.setPos(avatar_pos)
        base.cam.setH(avatar_head)
        #self.smiley = base.loader.loadModel('smiley')
        #self.smiley.setPos(Point3(0, 6, 0))
        #self.smiley.reparentTo(render)
        #print 'smiley', self.smiley.getPos()
        
        # load environment
        load_models()
        for item in PlaceModels._registry:
            if 'original' in item.group:
            #if 'better' in item.group:
                item.model = path_to_models + item.model
                model = base.loader.loadModel(item.model)
                model.setPos(item.location)
                model.setScale(item.scale)
                model.reparentTo(render)
                #if item.name is not 'sky':
                #if item.name is not 'sky' and item.name is not 'terrain':
                    #item.model = path_to_models + item.model
                    #model = base.loader.loadModel(item.model)
                    #model.setPos(item.location)
                    #model.setScale(item.scale)
                    #model.reparentTo(render)

        #sky = base.loader.loadModel('models/sky.egg')
        #sky = base.loader.loadModel('models/good_sky_hole.egg')
        #scale = 6  # 6 gets you just outside the walls. The further
        # back you go after that the more it cuts off, opposite of
        # what I had assumed
        #sky.setPos(0, 0, 0)
        #sky.setPos(-5.89054 * scale, 3.23145 * scale, -0.8 * scale)
        # z = 0 is too high. weird. -0.8 seems about even

        #sky.setScale(scale)
        #sky.reparentTo(render)
        #sky.setHpr(0, 0, 0)
        #terrain = base.loader.loadModel('models/courtyard_one.egg')
        #terrain.setPos(0, 0, 0.5)
        #terrain.setScale(2.5)
        #terrain.reparentTo(render)
        #b=OnscreenImage(image="models/pics/Mount_Rainier_6874h.jpg")
        #b.parent = base.cam
        #b.scale = (640, 0, 360)
        #b.pos = (20, 20, 10)
        #base.cam.node().getDisplayRegion(0).setSort(20)
        #imageObject = OnscreenImage(image = 'models/pics/Mount_Rainier_6874h.jpg', pos = (-0.5, 0, 0.02))
        #imageObject.parent = camera
        # A dictionary of what keys are curently being pressed
        self.keys = {"right" : 0,
                     "left" : 0}
        self.accept("escape", sys.exit)
        self.accept("arrow_right", self.setKey, ['right', 1])
        self.accept("arrow_left", self.setKey, ['left', 1])
        self.accept("arrow_right-up", self.setKey, ['right', 0])
        self.accept("arrow_left-up", self.setKey, ['left', 0])

        self.playTask = base.taskMgr.add(self.frame_loop, "frame_loop")
        self.playTask.last = 0
开发者ID:codedragon,项目名称:play_environ,代码行数:98,代码来源:play_environ.py

示例15: __init__

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setFullscreen [as 别名]
    def __init__(self):
        "初始化"
                
        dir = os.path.dirname(game_settings['save_folder'])
        if not os.path.exists(dir):
            os.makedirs(dir)
        
        self.initGameSettings()
        
        #读取设置文件
        loadPrcFile("config/PandaConfig.prc")
        
        loadPrcFileData('', 'win-size ' + str(game_settings['screen_resolution'][0]) + ' ' + str(game_settings['screen_resolution'][1]) )
        
        #构造Panda3D的ShowBase
        ShowBase.__init__(self)
        
        #Retrieving available resolutions
        #self.makeDefaultPipe()
        di = self.pipe.getDisplayInformation()
        self.supportedResolutions = []
        for index in range(di.getTotalDisplayModes()):
            self.supportedResolutions.append((di.getDisplayModeWidth(index), di.getDisplayModeHeight(index)))
        
        
        color_themes.initStyles()
        
        props = WindowProperties( self.win.getProperties() )
        props.setSize(int(game_settings['screen_resolution'][0]),int(game_settings['screen_resolution'][1]))
        if game_settings['full_screen'] and not props.getFullscreen():
            props.setFullscreen(True)
        props.setTitle(game_settings['window_title'])
        self.win.requestProperties(props)
        
        self.cam2dp.node().getDisplayRegion(0).setSort(-20)  #Set render2dp to background
        self.disableMouse() #Disable panda3d's default mouse control
        self.cam.node().getDisplayRegion(0).setActive(0) #disable default camera
        self.audioPlayer = AudioPlayer()
        self.focusStack = [] #a stack that shows windowstop window gets focus
        
        self._loadReadText()
        self._loadGlobalData()

            
        #add event handlers
        self.accept('alt-enter', self.toggleFullScreen)
        self.accept('save_data', self.save)
        self.accept('load_data', self.load)
        self.accept('load_memory', self.loadMemory)
        self.accept('request_focus', self.grantFocus)
        self.accept('remove_focus', self.cancelFocus)
        self.accept('return_to_title', self.returnToTitle)
        self.accept('start_game', self.startGame)
        self.accept('load_game', self.loadGame)
        self.accept('config_form', self.showConfig)
        self.accept('exit_game', self.exit)
        self.accept('quick_save', self.quickSave)
        self.accept('quick_load', self.quickLoad)
        self.accept('auto_save', self.autoSave)
        self.accept('print_screen', self.takeScrnShot)
        self.accept('f10', self.takeScrnShot)
        
        #Font setting
        self.textFont = color_themes.default_font
        
        #背景设置
        self.setBackgroundColor(0,0,0,1); 
        self.backgroundImage = None
            
        self.initGameWindows()
        
        self.mainMenu = None
        self.storyManager = None
开发者ID:WindyDarian,项目名称:Sogal,代码行数:75,代码来源:sogal_base.py


注:本文中的panda3d.core.WindowProperties.setFullscreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。