Esempio n. 1
0
class Application(object):

    def __init__(self):
        self.gloopy = None

    def run(self):
        self.gloopy = Gloopy()
        self.gloopy.init()
        self.gloopy.world.background_color = Color.Orange
        self.gloopy.camera.update=WobblyOrbit(
            center=Vector.origin,
            radius=3,
            axis=Vector(2, -3, 1),
            angular_velocity=0.8,
            wobble_size=0.0,
            wobble_freq=0.01,
        )
        self.gloopy.camera.look_at = Vector(0, 0, 0)
        
        self.keyhandler = KeyHandler(
            self.gloopy.world,
            self.gloopy.render,
            self.gloopy.camera,
        )
        self.gloopy.window.push_handlers(self.keyhandler)

        self.gloopy.run()
Esempio n. 2
0
def main():
    gloopy = Gloopy()
    gloopy.init()
    gloopy.world.background_color = Color.Random()

    add_items(gloopy, 400)
    toggle_attr(gloopy, 'orientation', Orientation.Random)

    gloopy.window.push_handlers(
        on_key_press=lambda s, m: on_key_press(gloopy, s, m)
    )
    gloopy.camera.update=WobblyOrbit(
        center=Vector.origin,
        radius=SIZE * 0.8,
        axis=Vector(2, 3, 1),
        angular_velocity=0,
        wobble_size=0.9,
        wobble_freq=pi/10,
    )
    gloopy.camera.look_at = Vector(0, -10, 0)
    gloopy.run()
Esempio n. 3
0
from math import cos

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

from gloopy import Gloopy
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)

gloopy.run()