# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
width = 768
height = 480
import pyglet
import cocos
from cocos.director import director
from cocos.actions import *
from cocos.layer import *

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__":
    print"""
    projection and viewport going bad when using grid.py
    same as test_fadeoutiles_bl.py but started in fullscreen.
    for other manifestations, run the original test_fadeoutiles_bl.py
    and do some ctrl-f
    """
    director.init( resizable=True, fullscreen=True )
    main_scene = cocos.scene.Scene()

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

    e = FadeOutBLTiles( grid=(16,12), duration=10 )
    main_scene.do( e + Reverse(e) )

    director.run (main_scene)
