本文整理汇总了Python中panda3d.core.WindowProperties.set_size方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.set_size方法的具体用法?Python WindowProperties.set_size怎么用?Python WindowProperties.set_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.WindowProperties
的用法示例。
在下文中一共展示了WindowProperties.set_size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_winprops_copy_ctor
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import set_size [as 别名]
def test_winprops_copy_ctor():
props = WindowProperties()
props.set_size(1, 2)
props2 = WindowProperties(props)
assert props == props2
assert props2.get_size() == (1, 2)
with pytest.raises(TypeError):
WindowProperties(None)
示例2: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import set_size [as 别名]
def __init__(self):
DirectObject.__init__(self)
self.base = ShowBase()
props = WindowProperties()
props.setCursorHidden(True)
props.set_size(1024, 768)
props.set_origin(0, 0)
self.base.win.requestProperties(props)
self.color_list = [1, 1, 1]
self.base.setBackgroundColor(self.color_list[:])
self.accept('q', self.close)
示例3: test_winprops_size_property
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import set_size [as 别名]
def test_winprops_size_property():
props = WindowProperties()
# Test get
props.set_size(1, 2)
assert props.size == (1, 2)
# Test has
props.clear_size()
assert props.size is None
# Test set
props.size = (4, 5)
assert props.get_size() == (4, 5)
# Test clear
props.size = None
assert not props.has_size()
示例4: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import set_size [as 别名]
def __init__(self, config=None):
if config is None:
self.config = {}
execfile('play_config.py', self.config)
else:
self.config = config
self.reward = None
print self.config['pydaq']
if pydaq and self.config.setdefault('pydaq', True) is not None:
self.reward = pydaq.GiveReward()
self.reward_count = 0
# adjustment to speed so corresponds to gobananas task
# 7 seconds to cross original environment
# speed needs to be adjusted to both speed in original
# environment and c_range of colors
# self.speed = 0.05 * (self.c_range[1] - self.c_range[0])
# speed is own variable, so can be changed during training.
self.speed = self.config['speed']
# need a multiplier to the joystick output to tolerable speed
self.vel_base = 4
self.max_vel = [500, 500, 0]
self.base = ShowBase()
self.base.disableMouse()
# self.base.setFrameRateMeter(True)
# assume we are showing windows unless proven otherwise
if self.config.get('win', True):
# only need inputs if we have a window
self.inputs = Inputs(self.base)
props = WindowProperties()
props.setCursorHidden(True)
props.setForeground(True)
print self.config.get('resolution')
if self.config.get('resolution'):
# main window
props.set_size(int(self.config['resolution'][0]), int(self.config['resolution'][1]))
# props.set_origin(1920, 0)
props.set_origin(500, 0)
else:
props.set_size(600, 600)
props.set_origin(400, 50)
self.base.win.requestProperties(props)
# print 'background color', self.base.getBackgroundColor()
# field = self.base.loader.loadModel("../goBananas/models/play_space/field.bam")
field = self.base.loader.loadModel("../goBananas/models/play_space/round_courtyard.bam")
field.setPos(0, 0, 0)
field.reparent_to(self.base.render)
field_node_path = field.find('**/+CollisionNode')
field_node_path.node().setIntoCollideMask(0)
sky = self.base.loader.loadModel("../goBananas/models/sky/sky_kahana2.bam")
sky.setPos(0, 0, 0)
sky.setScale(1.6)
sky.reparentTo(self.base.render)
windmill = self.base.loader.loadModel("../goBananas/models/windmill/windmill.bam")
windmill.setPos(-10, 30, -1)
windmill.setScale(0.03)
windmill.reparentTo(self.base.render)
# mountain = self.base.loader.loadModel("../goBananas/models/mountain/mountain.bam")
# mountain.setScale(0.0005)
# mountain.setPos(10, 30, -0.5)
# create the avatar
self.avatar = NodePath(ActorNode("avatar"))
self.avatar.reparentTo(self.base.render)
self.avatar.setPos(0, 0, 1)
self.avatar.setScale(0.5)
pl = self.base.cam.node().getLens()
pl.setFov(60)
self.base.cam.node().setLens(pl)
self.base.camera.reparentTo(self.avatar)
# initialize task variables
self.frame_task = None
self.started_game = None
self.showed_match = None
self.gave_reward = None
# initialize and start the game
self.set_next_trial()
示例5: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import set_size [as 别名]
def __init__(self, config=None):
# keep track of velocity, this allows me to counteract joystick with keyboard
self.velocity = LVector3(0)
if config is None:
self.config = {}
execfile('config.py', self.config)
else:
self.config = config
self.reward = None
if pydaq:
self.reward = pydaq.GiveReward()
self.reward_count = 0
# self.color_map always corresponds to (r, g, b)
# does not change during game, each game uses a particular color space
self.color_dict = square.make_color_map(self.config['colors'])
# sets the range of colors for this map
self.c_range = self.config['c_range']
# color variables (make dictionary?)
# color_list is set in beginning, and then after that this is only
# called again for non-random (training)
self.color_list = square.set_start_position_colors(self.config)
self.color_match = [0, 0, 0]
self.color_tolerance = []
self.last_avt, self.avt_factor = square.translate_color_map(self.config, self.color_dict, self.color_list)
print 'starting avt position', self.last_avt
print 'map avatar factor', self.avt_factor
self.random = True
if self.config.get('match_direction'):
self.random = False
# adjustment to speed so corresponds to gobananas task
# 7 seconds to cross original environment
# speed needs to be adjusted to both speed in original
# environment and c_range of colors
# self.speed = 0.05 * (self.c_range[1] - self.c_range[0])
# speed is own variable, so can be changed during training.
self.speed = self.config['speed']
# map avatar variables
self.render2d = None
self.match_square = None
self.map_avt_node = []
# need a multiplier to the joystick output to tolerable speed
self.vel_base = 3
self.max_vel = [500, 500, 0]
self.card = None
self.base = ShowBase()
self.base.disableMouse()
# assume we are showing windows unless proven otherwise
if self.config.get('win', True):
# only need inputs if we have a window
self.inputs = Inputs(self.base)
props = WindowProperties()
props.setCursorHidden(True)
props.setForeground(True)
print self.config.get('resolution')
if self.config.get('resolution'):
props.set_size(int(self.config['resolution'][0]), int(self.config['resolution'][1]))
props.set_origin(0, 0)
else:
props.set_size(600, 600)
props.set_origin(400, 50)
self.base.win.requestProperties(props)
# print self.base.win.get_size()
# setup color map on second window
sq_node = square.setup_square(self.config)
self.setup_display2(sq_node)
# print 'background color', self.base.getBackgroundColor()
# create the avatar
self.avatar = NodePath(ActorNode("avatar"))
self.avatar.reparentTo(self.base.render)
self.avatar.setH(self.base.camera.getH())
self.base.camera.reparentTo(self.avatar)
self.base.camera.setPos(0, 0, 0)
# initialize task variables
self.frame_task = None
self.started_game = None
self.showed_match = None
self.gave_reward = None
# initialize and start the game
self.set_next_trial()