Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
    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()
Exemplo n.º 4
0
# -*- indent-tabs-mode: t -*-

#!/usr/bin/env python

import sys, os

import soya
import soya.pudding as pudding

soya.init(width = 1024, height = 768)
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))

# initialise pudding
pudding.init()

scene = soya.World()

sword_model = soya.Model.get("sword")
sword = soya.Body(scene, sword_model)
sword.x = 1
sword.rotate_y(90.)

# one line rotation :)
sword.advance_time = lambda p: sword.rotate_y(5.*p)

light = soya.Light(scene)
light.set_xyz( .5, 0., 2.)

camera = soya.Camera(scene)
camera.z = 3.
Exemplo n.º 5
0
 def setup(self):
     soya.init("Loopy Demo", self.resolution[0], self.resolution[1])
     pudding.init()
     self.puddingRoot = self.createPuddingWidgets()
     self.createScene()
     self.idler = soya.Idler(self.scene)
Exemplo n.º 6
0
    soya.init('Canta', 1024, 768, 0)

    # working dir:
    APP_DIR = os.path.join('..', os.curdir)

    # fonts:
    font = soya.Font(os.path.join(APP_DIR, 'data', 'fonts', 'DejaVuSansCondensed.ttf'), 16, 12)

    # global colors:
    colors = Colors.Colors(debug = DEBUG)

    # set soya's style path:
    style = Style.Style(APP_DIR, font, colors, DEBUG)

    # initialize pudding:
    pudding.init(style = style)

    # set the root scene:
    scene = soya.World()

    # create the pudding root widget:
    widget = pudding.core.RootWidget(width = 1024, height = 768)

    # a test filter:
    test_filter = .50

    # create a simple label for the slider:
    slider_label = pudding.control.SimpleLabel(
                    widget,
                    label = '50',
                    font = font,
Exemplo n.º 7
0
    # working dir:
    APP_DIR = os.path.join('..', os.curdir)

    # fonts:
    font = soya.Font(
        os.path.join(APP_DIR, 'data', 'fonts', 'DejaVuSansCondensed.ttf'), 16,
        12)

    # global colors:
    colors = Colors.Colors(debug=DEBUG)

    # set soya's style path:
    style = Style.Style(APP_DIR, font, colors, DEBUG)

    # initialize pudding:
    pudding.init(style=style)

    # set the root scene:
    scene = soya.World()

    # create the pudding root widget:
    widget = pudding.core.RootWidget(width=1024, height=768)

    # a test filter:
    test_filter = .50

    # create a simple label for the slider:
    slider_label = pudding.control.SimpleLabel(widget,
                                               label='50',
                                               font=font,
                                               top=346,
Exemplo n.º 8
0
 def setup(self):
     soya.init("Loopy Demo", self.resolution[0], self.resolution[1])
     soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
     pudding.init()
     self.root = self.createWidgets()