本文整理汇总了Python中soya.set_root_widget函数的典型用法代码示例。如果您正苦于以下问题:Python set_root_widget函数的具体用法?Python set_root_widget怎么用?Python set_root_widget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_root_widget函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: __init__
def __init__(self, material, dialog):
self.active = 0
self.dialog = dialog
self.material = material
self.scene = soya.World()
self.camera = soya.Camera(self.scene)
soya.set_root_widget(self.camera)
soya.Light(self.scene).set_xyz(0.2, 2.0, 0.2)
#self.cube = cube.Cube(self.scene, material)
cube_world = cube.Cube(None, material)
self.cube = soya.Body(self.scene, cube_world.to_model())
self.cube.set_xyz(0.0, 0.0, -2.0)
self.cube.rotate_x(30.0)
开发者ID:deavid,项目名称:soyamirror,代码行数:17,代码来源:material.py
示例17: control_owned
def control_owned(self):
super(Mobile, self).control_owned()
local_mobiles = [mobile for mobile in self.level.mobiles if mobile.local]
self.control_keys = CONTROL_KEYS[min(len(local_mobiles), len(CONTROL_KEYS)) - 1]
if len(local_mobiles) == 1:
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,代码行数:19,代码来源:demo.py
示例18: __init__
def __init__(self):
tofu4soyapudding.GameInterface.__init__(self)
soya.init()
pudding.init()
self.player_character = None
# Creates a traveling camera in the scene, with a default look-toward-nothing
# traveling.
self.camera = soya.TravelingCamera(scene)
self.camera.back = 70.0
self.camera.add_traveling(soya.FixTraveling(soya.Point(), soya.Vector(None, 0.0, 0.0, 10.0)))
self.root = pudding.core.RootWidget(width = 640, height = 480)
soya.set_root_widget(self.root)
soya.root_widget.add_child(self.camera)
pudding.ext.fpslabel.FPSLabel(soya.root_widget, position = pudding.TOP_RIGHT)
开发者ID:deavid,项目名称:soyamirror,代码行数:19,代码来源:bbomber.py
示例19: _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.config['screen'].as_int('resolution_x'),
height=self.config['screen'].as_int('resolution_y'), \
top=0, left=0)
self.widget_properties['root_widget'] = self.root_widget
# Loading Label:
# This should come immediatly, but it comes too late (after
# the models are loaded).
lc_top = self.config['screen'].as_int('resolution_x') / 2
lc_left = self.config['screen'].as_int('resolution_x') / 2 - 100
self.loading_cont = pudding.container.HorizontalContainer( \
self.root_widget, \
top=lc_top,
left=lc_left,
width=10, height=10, z_index=1)
self.loading_cont.anchors = pudding.ANCHOR_RIGHT \
| pudding.ANCHOR_TOP | \
pudding.ANCHOR_LEFT
self.loading_cont.add_child(pudding.control.SimpleLabel(
label=_(u'Loading, please wait...'),
font=self.widget_properties['font']['p']['obj'],
top=10,
left=10,
color=self.widget_properties['font']['p']['color']
), pudding.EXPAND_HORIZ)
self.root_widget.add_child(self.camera)
soya.set_root_widget(self.root_widget)
if self.config['screen'].as_bool('fps_label'):
pudding.ext.fpslabel.FPSLabel(soya.root_widget, \
position = pudding.TOP_RIGHT)
pudding.main_loop.MainLoop(self.root_world).update()
开发者ID:tewe,项目名称:canta,代码行数:42,代码来源:core_init.py
示例20: main
def main():
DEBUG = 1
import sys
import os
import soya.cube
# init soya in resizable window:
soya.init('MovableCamera Module', 1024, 768, 0)
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'media', 'themes', 'kiddy', 'media'))
# set the root scene:
scene = soya.World()
# set up the light:
light = soya.Light(scene)
light.set_xyz(0.0, 0.7, 1.0)
# set up the camera:
camera = MovableCamera(app_dir = '.', parent_world = scene, debug = DEBUG)
camera.set_xyz(0.0, 0, 10.0)
# a test cube in the background:
test_cube_world = soya.cube.Cube()
test_cube_world.model_builder = soya.SolidModelBuilder()
test_cube = soya.Body(scene, test_cube_world.to_model())
test_cube.rotate_y(45.0)
test_cube.rotate_x(45.0)
atmosphere = soya.SkyAtmosphere()
atmosphere.bg_color = (1.0, 0.0, 0.0, 1.0)
atmosphere.ambient = (0.5, 0.5, 0.0, 1.0)
atmosphere.skyplane = 1
atmosphere.sky_color = (1.0, 1.0, 0.0, 1.0)
atmosphere.cloud = soya.Material(soya.Image.get('cloud.png'))
scene.atmosphere = atmosphere
# set our root widget:
soya.set_root_widget(camera)
# start soya main loop:
soya.MainLoop(scene).main_loop()
开发者ID:spiderbit,项目名称:canta,代码行数:41,代码来源:movable_camera.py
注:本文中的soya.set_root_widget函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论