コード例 #1
0
ファイル: glitches.py プロジェクト: pdevine/suburbia
def main():
    global win
    clock.schedule(rabbyt.add_time)

    win = pyglet.window.Window(width=SCREEN_WIDTH, height=SCREEN_HEIGHT)
    window.set_window(win)

    bgPat = pyglet.image.SolidColorImagePattern((200, 200, 255, 255))
    bg = pyglet.image.create(window.game_window.width, window.game_window.height, bgPat)

    rabbyt.set_default_attribs()
    bubbles.init()
    bubbles.win = win

    storyTeller = narrative.StoryTeller()

    fGen = FloaterGenerator()
    fGen.hitRequiredStage = True
    fGen.active = True
    sGen = SourcecodeGenerator()
    sGen.hitRequiredStage = True
    sGen.active = True

    events.Fire("NewStage", narrative.terror)

    scene = sky.Background(None)

    while not win.has_exit:
        tick = clock.tick()
        win.dispatch_events()

        bubbles.bubbleMaker.update(tick)
        scene.update(tick)
        fGen.update(tick)
        sGen.update(tick)

        events.ConsumeEventQueue()

        rabbyt.clear((1, 1, 1))
        bg.blit(0, 0)

        scene.draw()
        fGen.draw()
        bubbles.bubbleMaker.draw()
        sGen.draw()

        win.flip()
コード例 #2
0
ファイル: leaves.py プロジェクト: pdevine/suburbia
def main():
    global win
    clock.schedule(rabbyt.add_time)

    win = pyglet.window.Window(width=SCREEN_WIDTH, height=SCREEN_HEIGHT)
    window.set_window(win)
    rabbyt.set_default_attribs()
    bubbles.init()
    bubbles.win = win

    storyTeller = narrative.StoryTeller()

    wind = Wind()
    leafgen = LeafGenerator()
    leafgen.active = True
    leaves = LeafGroup()

    #bg = sky.Background(None)

    objs = [leafgen, leaves]
    magicEventRegister(win, events, objs)

    while not win.has_exit:
        tick = clock.tick()
        win.dispatch_events()

        bubbles.bubbleMaker.update(tick)
        #bg.update(tick)
        for obj in objs:
            obj.update(tick)
        wind.update(tick)
        
        events.ConsumeEventQueue()

        rabbyt.clear((1, 1, 1))

        #bg.draw()
        leaves.draw()
        bubbles.bubbleMaker.draw()

        win.flip()