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


Python soya.set_root_widget函数代码示例

本文整理汇总了Python中soya.set_root_widget函数的典型用法代码示例。如果您正苦于以下问题:Python set_root_widget函数的具体用法?Python set_root_widget怎么用?Python set_root_widget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: control_lost

  def control_lost(self):
    super(Mobile, self).control_lost()

    if self.control_keys == CONTROL_KEYS[0]:
      soya.MAIN_LOOP.camera.parent.remove(soya.MAIN_LOOP.camera)
      soya.MAIN_LOOP.camera = None
      soya.set_root_widget(None)
开发者ID:deavid,项目名称:soyamirror,代码行数:7,代码来源:demo.py

示例2: main

def main():
    soya.init()
    #soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))

    # Creates the scene.
    scene = soya.World()

    # Creates a camera.
    camera = soya.Camera(scene)
    camera.set_xyz(0.0, 0.0, 4.0)
    camera.fov = 100.0

    # Creates a dragdrop world.
    world = Editor(scene, camera)

    # Adds some bodys with different models, at different positions.
    red   = soya.Material(); red  .diffuse = (1.0, 0.0, 0.0, 1.0)
    green = soya.Material(); green.diffuse = (0.0, 1.0, 0.0, 1.0)
    blue  = soya.Material(); blue .diffuse = (0.0, 0.0, 1.0, 1.0)

    soya.Body(world, soya.cube.Cube(None, red  ).to_model()).set_xyz(-1.0, -1.0, 1.0)
    soya.Body(world, soya.cube.Cube(None, green).to_model()).set_xyz( 0.0, -1.0, 0.0)
    soya.Body(world, soya.cube.Cube(None, blue ).to_model()).set_xyz( 1.0, -1.0, -1.0)

    soya.Body(world, soya.sphere.Sphere().to_model()).set_xyz(1.0, 1.0, 0.0)

    # Adds a light.
    light = soya.Light(scene)
    light.set_xyz(0.0, 0.2, 1.0)

    soya.set_root_widget(camera)

    # Main loop

    soya.MainLoop(scene).main_loop()
开发者ID:spiderbit,项目名称:canta,代码行数:35,代码来源:editor.py

示例3: setup_scene

	def setup_scene(self):
		self.scene = scene = soya.World()
		self.light = soya.Light(scene)
		self.camera = soya.Camera(scene)
		soya.set_root_widget(self.camera)
		self.main_loop = soya.MainLoop(scene)
		self.run_soya_rounds() # XXX dismiss init events (a big mouse one)
开发者ID:deavid,项目名称:soyamirror,代码行数:7,代码来源:testlib.py

示例4: activate

	def activate(self, event = None):
		if not self.active:
			self.active = 1
			soya.set_root_widget(self.camera)
			self.render()
			
			self.cancel = self.dialog.after(50, self.rotate)
开发者ID:deavid,项目名称:soyamirror,代码行数:7,代码来源:material.py

示例5: begin_guiloop

def begin_guiloop(callbackround=None, callbackadvance=None ):
	global root, mainloop
	global scene, callback_round, callback_advance, camera, scene_body
	callback_round = callbackround
	callback_advance = callbackadvance 


	soya.set_root_widget(root)
	scene_body = SceneBody(scene,None)
	mainloop.main_loop()
开发者ID:deavid,项目名称:pyworlds,代码行数:10,代码来源:worlds.py

示例6: setUp

	def setUp(self):
		self.scene = scene = soya.World()

		light = soya.Light(scene)
		light.set_xyz(15, 15, -15)
		camera = soya.Camera(scene)
		camera.set_xyz(0, 0,-10)
		camera.look_at(soya.Point(scene, 0, 0, 0))
		soya.set_root_widget(camera)
		self.main_loop = soya.MainLoop(scene)
开发者ID:deavid,项目名称:soyamirror,代码行数:10,代码来源:unittest_geom.py

示例7: test_render_front

	def test_render_front(self):
		soya.set_root_widget(self.blue_camera)
		soya.render()
		screenshot = soya.screenshot()
		self.assertEquals(screenshot.getpixel((0,0)), (0, 0, 255))

		soya.set_root_widget(self.red_camera)
		soya.render()
		screenshot = soya.screenshot()
		self.assertEquals(screenshot.getpixel((0,0)),(255, 0, 0))
开发者ID:deavid,项目名称:soyamirror,代码行数:10,代码来源:unittest_render.py

示例8: __init__

 def __init__(self):
     super(GUIManager, self).__init__()
     #Graphics setup
     self.__setDataDir()
     #self.scene = self.__createScene()
     self.camera = self.__createCamera(self)
     self.__setLights(self)
     self.level = self.__createLevel(self)
     soya.set_root_widget(self.camera)
     
     self.game = None
开发者ID:blackmius,项目名称:pgame,代码行数:11,代码来源:runsoyagui.py

示例9: control_owned

 def control_owned(self):
   tofu_enet.Mobile.control_owned(self)
   
   if not getattr(soya.MAIN_LOOP, "camera", None):
     soya.MAIN_LOOP.camera = soya.TravelingCamera(soya.MAIN_LOOP.scenes[0])
     soya.MAIN_LOOP.camera.back = 70.0
     soya.set_root_widget(soya.MAIN_LOOP.camera)
     
   traveling = soya.ThirdPersonTraveling(self)
   traveling.distance = 5.0
   soya.MAIN_LOOP.camera.add_traveling(traveling)
   soya.MAIN_LOOP.camera.zap()
开发者ID:deavid,项目名称:soyamirror,代码行数:12,代码来源:demo.py

示例10: test_render_back_read

	def test_render_back_read(self):
		"""Test that rendering made without switching back buffer are accessible with screenshot"""
		# Screenshot in front buffer
		soya.set_root_widget(self.blue_camera)
		soya.render()
		screenshot = soya.screenshot()
		self.assertEquals(screenshot.getpixel((0,0)),(0, 0, 255))

		# Screenshot in back buffer
		soya.set_root_widget(self.red_camera)
		soya.render(swap_buffer=False)
		screenshot = soya.screenshot(use_back_buffer=True)
		self.assertEquals(screenshot.getpixel((0,0)),(255, 0, 0))
开发者ID:deavid,项目名称:soyamirror,代码行数:13,代码来源:unittest_render.py

示例11: begin_loop

def begin_loop(callbackround=None, callbackadvance=None, engine="soya" ):
	global scene, callback_round, callback_advance, camera,mainloop
        import soya.pudding as pudding
	callback_round = callbackround
	callback_advance = callbackadvance 
	if engine=="soya":
            soya.set_root_widget(camera)
        elif engine=="pudding":
            pass
        else:
            print "error engine %s unknown" % engine
	#soya.set_root_widget(soya.widget.Group())
	#soya.root_widget.add(camera)
	#if enable_fps: soya.root_widget.add(soya.widget.FPSLabel())
	return mainloop.main_loop()
开发者ID:deavid,项目名称:pyworlds,代码行数:15,代码来源:worlds.py

示例12: control_owned

 def control_owned(self):
   tofu_udp.InterpolatedAnimatedMobile.control_owned(self)
   
   if not getattr(soya.MAIN_LOOP, "camera", None):
     soya.MAIN_LOOP.camera = soya.TravelingCamera(soya.MAIN_LOOP.scenes[0])
     soya.MAIN_LOOP.camera.back = 70.0
     group = soya.widget.Group()
     group.add(soya.MAIN_LOOP.camera)
     soya.widget.FPSLabel(group)
     soya.set_root_widget(group)
     
   traveling = soya.ThirdPersonTraveling(self)
   traveling.distance = 5.0
   soya.MAIN_LOOP.camera.add_traveling(traveling)
   soya.MAIN_LOOP.camera.zap()
开发者ID:deavid,项目名称:soyamirror,代码行数:15,代码来源:demo.py

示例13: _init_widget_engine

    def _init_widget_engine(self):
        """Initialize the pudding widget system, create a root widget.
        """
        pudding.init(style=Style(self.widget_properties))

        # Create a pudding root widget:
        self.root_widget = pudding.core.RootWidget( \
                width=self.screen_res_x,
                height=self.screen_res_y, \
                top=0, left=0)

        self.widget_properties['root_widget'] = self.root_widget

        self.root_widget.add_child(self.camera)
        soya.set_root_widget(self.root_widget)
        pudding.main_loop.MainLoop(self.root_world).update()
开发者ID:spiderbit,项目名称:canta,代码行数:16,代码来源:core.py

示例14: _create_camera_and_light

 def _create_camera_and_light(self):
     self.light = soya.Light(self.scene)
     self.light.set_xyz(*self.light_xyz)
     
     self.camera =  soya.Camera(self.scene)
     self.camera.z = self.camera_z
     self.camera.fov = self.camera_fov
     self.camera.ortho = True
     
     # calculate the "border" of the field
     p = self.camera.coord2d_to_3d(0.0, 0.0, 0.0)
     self.rhomb.left = p.x
     self.rhomb.right = -p.x
     self.rhomb.top = p.y
     self.rhomb.bottom = -p.y
     
     soya.set_root_widget(self.camera)
开发者ID:JingLu92,项目名称:pyff,代码行数:17,代码来源:MovingRhombGL.py

示例15: init_pudding

def init_pudding(width = 1020,height = 760,title="PyWorlds (Soya3D)", options = {}):
	global root,viewport,camera,scene,mainloop, pyworlds_engine
        soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
	pyworlds_engine = "pudding"
        import soya.pudding as pudding
        soya.init(width=width, height= height, title=title)
	pudding.init()
	scene = pyworlds.basics.scene.scene
	mainloop=pudding.main_loop.MainLoop(scene)
	scene.mainloop=mainloop
	scene.round_duration=.04
	mainloop.round_duration=.04
        
	
        if 'nobasics' not in options: init_basicscene()
        soya.set_root_widget(pudding.core.RootWidget(width = width,height = height))
        if 'nochild' not in options: soya.root_widget.add_child(camera)
开发者ID:deavid,项目名称:pyworlds,代码行数:17,代码来源:worlds.py


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