Пример #1
0
def main():
    director.init(resizable=True)
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add(BackgroundLayer(), z=0)

    main_scene.do(Waves3D(waves=8, amplitude=40, grid=(16, 16), duration=5))
    director.run(main_scene)
Пример #2
0
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add( BackgroundLayer(), z=0 )

    main_scene.do( Waves3D( waves=8, amplitude=40, grid=(16,16), duration=5) )
    director.run (main_scene)
Пример #3
0
def main():

    pyglet.resource.path.append('data')
    pyglet.resource.reindex()
    font.add_directory('data')

    director.init()
    director.set_depth_test(True)

    s = get_menu_scene()
    director.run (s)
Пример #4
0
	def __init__(self):
		director.init(resizable=False, width=800, height=600)
		director.set_depth_test()

		self.hello = 'Hello'
		self.menu_scene = Scene(menu.BGLayer(),
								MultiplexLayer(menu.MainMenu(self), menu.OptionMenu(), menu.WaitLayer(self)))

		self.player_id = None
		self.ready = False
		self.max_players = 2
		self.sock = None
Пример #5
0
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add( BackgroundLayer(), z=0 )

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do( JumpTiles3D( jumps=2, amplitude=100, grid=(16,12), duration=4) )
    director.run (main_scene)
Пример #6
0
def start():
    director.set_depth_test()
    background = Background("halloween.jpg")
    background.position = (director.get_window_size()[0] / 2,
                           director.get_window_size()[1] / 2)

    firelayer = FireManager(director.get_window_size()[0], 250)
    menulayer = MultiplexLayer(MenuPrincipal(), OptionMenu(), CreditsLayer())

    scene = Scene(background, menulayer, firelayer)

    return scene
Пример #7
0
def main():
    director.init(resizable=True)
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add(BackgroundLayer(), z=0)

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do(
        JumpTiles3D(jumps=2, amplitude=100, grid=(16, 12), duration=4))
    director.run(main_scene)
Пример #8
0
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()
    main_scene.add( BackgroundLayer(), z=0 )

    action1 = ac.WavesTiles3D( waves=2, amplitude=70, grid=(16,16), duration=3)
    action1 = ac.Reverse(action1)

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do( action1 )
    director.run (main_scene)
Пример #9
0
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()
    main_scene.add( BackgroundLayer(), z=0 )

    rot = OrbitCamera( delta_z=60, duration=2 )

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do( rot * 3 )

    director.run (main_scene)
Пример #10
0
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add( BackgroundLayer(), z=0 )

    # important:  maintain the aspect ratio in the grid
    e = Ripple3D( radius=240, grid=(32,24), duration=20, waves=20,
                  amplitude=60 )
    main_scene.do( e )

    director.run (main_scene)
Пример #11
0
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add( BackgroundLayer(), z=0 )

    # important:  maintain the aspect ratio in the grid
    e = Ripple3D( radius=240, grid=(32,24), duration=20, waves=20,
                  amplitude=60 )
    main_scene.do( e )

    director.run (main_scene)
Пример #12
0
def main():
    director.init(resizable=True)
    director.set_depth_test()

    main_scene = cocos.scene.Scene()
    main_scene.add(BackgroundLayer(), z=0)

    rot = OrbitCamera(delta_z=60, duration=2)

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do(rot * 3)

    director.run(main_scene)
Пример #13
0
def main():
    director.init(resizable=True)
    director.set_depth_test()

    main_scene = cocos.scene.Scene()
    main_scene.add(BackgroundLayer(), z=0)

    action1 = ac.WavesTiles3D(waves=2, amplitude=70, grid=(16, 16), duration=3)
    action1 = ac.Reverse(action1)

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do(action1)
    director.run(main_scene)
Пример #14
0
def main():

    pyglet.resource.path.append('data')
    pyglet.resource.reindex()
    font.add_directory('data')
    font.add_directory('data/fonts')

    director.init( width=800, height=600)
    director.set_depth_test(True)

#    s = get_menu_scene()
    s = get_intro_scene()
#    s = get_game_scene()
    director.run (s)
Пример #15
0
def main():
    print(description)
    director.init(resizable=True)
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add(BackgroundLayer(), z=0)

    # important:  maintain the aspect ratio in the grid
    e = Lens3D(center=(320, 200), lens_effect=0.9, radius=240, grid=(64, 48), duration=5)

    # StopGrid returns to the normal view
    main_scene.do(Delay(1) + e + StopGrid())

    director.run(main_scene)
Пример #16
0
def main():
    director.init(resizable=True)
    director.set_depth_test()

    main_scene = cocos.scene.Scene()
    main_scene.add(BackgroundLayer(), z=0)

    action1 = ac.WavesTiles3D(waves=2, amplitude=70, grid=(16, 16), duration=3)
    action2 = (ac.Delay(0.5) + ac.CallFunc(toggle_fullscreen) + ac.Delay(2.0) +
               ac.CallFunc(toggle_fullscreen))
    combo_action = action1 | action2

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do(combo_action)
    director.run(main_scene)
Пример #17
0
def main():
    print(description)
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add( BackgroundLayer(), z=0 )

    # important:  maintain the aspect ratio in the grid
    e = Lens3D( center=(320,200), lens_effect=0.9, radius=240, grid=(64,48),
                duration=5 )

    # StopGrid returns to the normal view
    main_scene.do( Delay(1) + e + StopGrid() )

    director.run (main_scene)
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()
    main_scene.add( BackgroundLayer(), z=0 )

    action1 = ac.WavesTiles3D( waves=2, amplitude=70, grid=(16,16), duration=3)
    action2 = ( ac.Delay(0.5) +
                ac.CallFunc(toggle_fullscreen) +
                ac.Delay(2.0) +
                ac.CallFunc(toggle_fullscreen))
    combo_action = action1 | action2

    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do( combo_action )
    director.run (main_scene)
def main():
    director.init(resizable=True)
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add(BackgroundLayer(), z=0)

    # set a 3d grid with a grid3d action
    e = WavesTiles3D(amplitude=60, waves=4, grid=(32, 24), duration=4)

    # use the remaining grid and move it's camera
    rot = OrbitCamera(angle_x=45, angle_z=0, delta_z=360, duration=4)

    main_scene.do(e)
    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do(rot + Reverse(rot))

    director.run(main_scene)
def main():
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add( BackgroundLayer(), z=0 )

    # set a 3d grid with a grid3d action
    e = WavesTiles3D( amplitude=60, waves=4, grid=(32,24), duration=4)

    # use the remaining grid and move it's camera
    rot = OrbitCamera( angle_x=45,  angle_z=0, delta_z=360, duration=4 )

    main_scene.do( e )
    # In real code after a sequence of grid actions the StopGrid() action
    # should be called. Omited here to stay in the last grid action render
    main_scene.do( rot + Reverse(rot) )

    director.run (main_scene)
Пример #21
0
    def __init__(self):
        name = "None"


        # COCOS INIT
        director.init()

        # enable depth test
        director.set_depth_test()

        # Box2D Initialization
        self.worldAABB=box2d.b2AABB()
        self.worldAABB.lowerBound = (-200.0, -100.0)
        self.worldAABB.upperBound = ( 200.0, 200.0)
        gravity = (0.0, -10.0)
        doSleep = True

        self.world = box2d.b2World(self.worldAABB, gravity, doSleep)

        # self.debugDraw = CairoDebugDraw()
        # self.world.SetDebugDraw(self.debugDraw)

        settings = fwSettings
        self.settings = settings
        self.flag_info = [ ('draw_shapes', settings.drawShapes,
                            box2d.b2DebugDraw.e_shapeBit),
                           ('draw_joints', settings.drawJoints,
                            box2d.b2DebugDraw.e_jointBit),
                           ('draw_controlers', settings.drawControllers,
                            box2d.b2DebugDraw.e_controllerBit),
                           ('draw_core_shapes', settings.drawCoreShapes,
                            box2d.b2DebugDraw.e_coreShapeBit),
                           ('draw_aabbs', settings.drawAABBs,
                            box2d.b2DebugDraw.e_aabbBit),
                           ('draw_obbs', settings.drawOBBs,
                            box2d.b2DebugDraw.e_obbBit),
                           ('draw_pairs', settings.drawPairs,
                            box2d.b2DebugDraw.e_pairBit),
                           ('draw_center_of_masses', settings.drawCOMs,
                            box2d.b2DebugDraw.e_centerOfMassBit),]
Пример #22
0
        # load the image form file
        self.image = pyglet.resource.image('flag.png')

    def draw(self):
        # blit the image on every frame
        self.image.blit(0, 0)


if __name__ == "__main__":
    # initialize the director,
    # enabling to resize the main window
    director.init(resizable=True)

    # enable opengl depth test
    # since we are using z-values
    director.set_depth_test()

    # create an Scene with 1 layer: BackgroundLayer
    scene = Scene(BackgroundLayer())

    # create a Lens effect action
    #  radius: 150 pixels
    #  lens_effect: 0.7, a strong "lens". 0 means no effect at all. 1 means very strong
    #  center: center of the lens
    #  grid=(20,16): create a grid of 20 tiles x 16 tiles. More tiles will
    #     look better but the performance will decraese
    #  duration=10: 10 seconds
    lens = Lens3D(radius=150,
                  lens_effect=0.7,
                  center=(150, 150),
                  grid=(20, 16),
Пример #23
0
def main():
    director.init(width=900, height=498)
    director.set_depth_test()

    desktopScene = Scene(BackGroundLayer())
    director.run(desktopScene)
Пример #24
0
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#


import cocos
from cocos.director import director
from cocos.actions import *
from cocos.layer import *
import pyglet

class BackgroundLayer( cocos.layer.Layer ):
    def __init__(self):
        super( BackgroundLayer, self ).__init__()
        self.img = pyglet.resource.image('background_image.png')

    def draw( self ):
        self.img.blit(0,0)

if __name__ == "__main__":
    director.init( resizable=True )
    director.set_depth_test()

    main_scene = cocos.scene.Scene()

    main_scene.add( BackgroundLayer(), z=0 )

    main_scene.do( WavesTiles3D( waves=8, amplitude=70, grid=(16,16), duration=10) )
    director.run (main_scene)