Exemple #1
0
def main(args):
    options = Options(args) # create_parser().parse_args(sys.argv[1:])
    camera = GameItem(
        position=Vector(0, 0, 10),
        look_at=Vector.origin,
        update = Interpolate(WobblyOrbit(
            center=Vector.origin,
            radius=3,
            axis=Vector(2, -3, 1),
            angular_velocity=0.8,
            wobble_size=0.0,
            wobble_freq=0.01,
        ),
    ))
    world = World()
    window = create_window(options)
    window.push_handlers(create_keyhandler(Controller(world, camera)))
    mainloop(world, window, options, camera)
Exemple #2
0
from math import cos

# find gloopy in '../..', so we can run even if Gloopy is not installed
import fixpath

from gloopy.mainloop import mainloop
from gloopy.color import Color
from gloopy.geom.vector import Vector
from gloopy.gameitem import GameItem
from gloopy.shapes.cube import Cube


gloopy = Gloopy()
gloopy.init()

def move_around(item, time, dt):
    item.position += Vector(cos(time*2)/300, cos(time*3)/400, 0)

item = GameItem(
    shape=Cube(1, Color.Blue),
    update=move_around,
)

gloopy.world.add(item)

gloopy.camera.position = Vector(1, 2, 3)

mainloop(world, window, options, camera)