本文整理汇总了Python中panda3d.core.WindowProperties.setSize方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.setSize方法的具体用法?Python WindowProperties.setSize怎么用?Python WindowProperties.setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.WindowProperties
的用法示例。
在下文中一共展示了WindowProperties.setSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def __init__(self):
ShowBase.__init__(self)
Globals.OFFLINE = False
self.client = 0
self.engine = 0
#PStatClient.connect()
wp = WindowProperties()
wp.setSize(Settings.WIDTH, Settings.HEIGHT)
wp.setTitle("Modifire")
wp.setMouseMode(WindowProperties.MRelative)
#wp.setCursorHidden(True)
base.win.requestProperties(wp)
base.setBackgroundColor(0.133, 0.133, 0.133)
self.disableMouse()
self.client = Client()
self.mainMenu = MainMenu()
self.SetupEventHandlers()
self.pid = -1
self.loadingScreen = None
SettingsController.LoadClientSettings()
version = OnscreenText(text = Globals.VERSION, pos = (0.3, -0.07), scale = 0.07, fg = (1, 1, 1, 1))
version.reparentTo(base.a2dTopLeft)
version.setBin('fixed', 200)
Preloader.Preload()
示例2: setupWindow
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [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))
示例3: createBuffer
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
""" Low-level buffer creation. Not intended for public use. """
winprops = WindowProperties()
winprops.setSize(xsize, ysize)
props = FrameBufferProperties(FrameBufferProperties.getDefault())
props.setBackBuffers(0)
props.setRgbColor(1)
props.setDepthBits(depthbits)
props.setStereo(self.win.isStereo())
depthtex, colortex, auxtex0, auxtex1 = texgroup
if (auxtex0 != None):
props.setAuxRgba(1)
if (auxtex1 != None):
props.setAuxRgba(2)
buffer=base.graphicsEngine.makeOutput(
self.win.getPipe(), name, -1,
props, winprops, GraphicsPipe.BFRefuseWindow | GraphicsPipe.BFResizeable,
self.win.getGsg(), self.win)
if (buffer == None):
return buffer
if (depthtex):
buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
if (colortex):
buffer.addRenderTexture(colortex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPColor)
if (auxtex0):
buffer.addRenderTexture(auxtex0, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba0)
if (auxtex1):
buffer.addRenderTexture(auxtex1, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba1)
buffer.setSort(self.nextsort)
buffer.disableClears()
self.nextsort += 1
return buffer
示例4: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def __init__(self):
ShowBase.__init__(self)
wp = WindowProperties()
wp.setSize(850, 480)
wp.setTitle("GAME")
base.win.requestProperties(wp)
bgg = BlockGeometryGenerator()
blocks = []
for x in xrange(1):
for y in xrange(512):
for z in xrange(64):
bid = random.randint(0, 255)
blocks.append(bid)
bgg.GenerateBlockGeometry(x, y, z, Block(bid), [0])
#blocks[x * 512 * 64 + y * 64 + z] = 1
print x
ambientLight = AmbientLight('ambientLight')
ambientLight.setColor(Vec4(0.2, 0.2, 0.2, 1))
ambientLightNP = render.attachNewNode(ambientLight)
render.setLight(ambientLightNP)
示例5: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def __init__(self):
self.base = ShowBase()
# graphics
# window
props = WindowProperties()
self.win_size = 600
props.setSize(self.win_size, self.win_size)
self.base.win.requestProperties(props)
# set up key
self.accept("c", self.move_center)
self.accept("b", self.plot_bananas)
self.accept("space", self.change_both)
self.num_bananas = 10
# total area is 100 (not true of the game, but just scales.
# was easier to make everything 1/2 size for this size window)
high_area = 0.25 * 0.33 * 100
middle_area = 0.25 * 100
self.high_radius = sqrt(high_area / pi)
self.middle_radius = sqrt(middle_area / pi)
self.high_reward = 6
self.middle_reward = 4
self.low_reward = 2
#print self.high_radius
#print self.middle_radius
self.weight_center = (random.uniform(-5, 5), random.uniform(-5, 5))
#print('weight center', self.weight_center)
self.banana_model = []
self.center_model = None
self.high_node = None
self.high_circle = None
self.middle_node = None
self.middle_circle = None
self.plot_border()
self.plot_bananas()
self.plot_circles()
示例6: setupWindow
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [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')
示例7: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [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=[]
示例8: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def __init__(self):
DirectObject.__init__(self)
self.base = ShowBase()
resolution = (1024, 768)
wp = WindowProperties()
wp.setSize(int(resolution[0]), int(resolution[1]))
wp.setOrigin(0, 0)
self.base.win.requestProperties(wp)
# depth completely doesn't matter for this, since just 2d, and no layers
self.depth = 0
self.base.setBackgroundColor(115 / 255, 115 / 255, 115 / 255)
# set up a 2d camera
camera = self.base.camList[0]
lens = OrthographicLens()
lens.setFilmSize(int(resolution[0]), int(resolution[1]))
lens.setNearFar(-100, 100)
camera.node().setLens(lens)
camera.reparentTo(self.base.render)
self.accept("escape", sys.exit)
# spread out some positions
self.positions = [(-200, 0, -200),
(0, 0, -200),
(200, 0, -200),
(-200, 0, 0),
(0, 0, 0),
(200, 0, 0),
(-200, 0, 200),
(0, 0, 200),
(200, 0, 200)]
self.all_smiles()
示例9: toggle_fullscreen
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [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()
示例10: setResolution
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def setResolution( self, w, h ):
wp = WindowProperties()
wp.setSize( w, h )
if os.name == 'posix':
self.openMainWindow()
self.graphicsEngine.openWindows()
self.win.requestProperties( wp )
示例11: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def __init__(self):
ShowBase.__init__(self)
wp = WindowProperties()
wp.setSize(850, 480)
wp.setTitle("GAME")
base.win.requestProperties(wp)
c = Client()
示例12: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def __init__(self):
ShowBase.__init__(self)
wp = WindowProperties()
wp.setSize(850, 480)
wp.setTitle("GAME")
base.win.requestProperties(wp)
c = DeathNotifications()
self.accept('a', c.AddMessage, extraArgs=['Player1', 'mp5', 'Tedasdasd'])
示例13: toggle_fullscreen
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [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)
示例14: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [as 别名]
def __init__(self):
self.base = ShowBase()
config = {}
execfile('cross_config.py', config)
if not unittest:
JoystickHandler.__init__(self)
self.base.disableMouse()
print('Subject is', config['subject'])
# set up reward system
if config['reward'] and PYDAQ_LOADED:
self.reward = pydaq.GiveReward()
print 'pydaq'
else:
self.reward = None
self.frameTask = self.base.taskMgr.add(self.frame_loop, "frame_loop")
if not unittest:
wp = WindowProperties()
wp.setSize(1280, 800)
wp.setOrigin(0, 0)
base.win.requestProperties(wp)
self.crosshair = TextNode('crosshair')
self.crosshair.setText('+')
textNodePath = aspect2d.attachNewNode(self.crosshair)
textNodePath.setScale(0.2)
self.setup_inputs()
# starting variables. "suppose" to be initiated here, which makes it silly
# to then have them again, but kind of necessary to test. Making PyCharm happy ;-)
self.x_mag = 0
self.y_mag = 0
# variables for counting how long to hold joystick
self.js_count = 0
# how much to push joystick before reward
self.js_goal = config['goal']
# (count increases before checking for goal match)
# default is to reward for backward movement. May want
# to make this a configuration option instead.
# zero, all backward allowed
# one, straight backward not rewarded
# two, no backward rewarded
self.backward = config['backward']
self.forward = True
self.right = True
self.left = True
# all kinds of start defaults
self.delay_start = False
self.reward_delay = False
self.reward_time = config['pulseInterval'] # 200 ms
self.reward_override = False
self.reward_on = True
self.current_dir = None
self.frameTask.delay = 0
print 'initialized'
示例15: toggleFullScreen
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setSize [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])