import cocos
import pyglet

class RaoulMenu(cocos.menu.Menu):
    def __init__(self):
        super(RaoulMenu, self).__init__()

        self.font_item['font_name'] = 'Jugend WF' 
        self.font_item['font_size'] = 50

        self.font_item_selected['font_name'] = 'Jugend WF' 
        self.font_item_selected['font_size'] = 50       

        self.menu_valign = cocos.menu.BOTTOM
        self.menu_halign = cocos.menu.CENTER
        self.y += 100

    def on_quit(self):
        pass

class MenuScene(cocos.scene.Scene):

    def __init__(self):

        super(MenuScene, self).__init__()

        self.bg_layer = cocos.layer.Layer()
        self.titlecard = cocos.sprite.Sprite('img/menucard.png')
        self.titlecard.position = 400,300
        self.bg_layer.add(self.titlecard)
        self.add(self.bg_layer)

        self.menu_layer = RaoulMenu()
        l = []
        l.append(cocos.menu.MenuItem('Play', self.play))
        l.append(cocos.menu.MenuItem('Quit', self.close_app))
        self.menu_layer.create_menu(l, None, None)
        self.add(self.menu_layer)

        self.game_scene = None


    def play(self):
        if self.game_scene is not None:
            cocos.director.director.push(self.game_scene)

    def close_app(self):
        cocos.director.director.terminate_app = True

