5 import pygame.locals as pgl
7 from naja.constants import KEYS
8 from naja.events import SceneChangeEvent, LoadGameEvent
9 from naja.gamestate import GameState
10 from naja.scenes.scene import Scene
11 from naja.scenes.howto import HowtoScene
12 from naja.widgets.image_box import ImageBox
13 from naja.widgets.selector import SelectorWidget
14 from naja.widgets.text import TextWidget
17 class IntroductionScene(Scene):
18 def __init__(self, state):
19 super(IntroductionScene, self).__init__(state)
21 background = ImageBox(
22 (0, 0), "screens/splash.png")
25 selector = SelectorWidget()
28 y_offset, y_diff = 270, 40
33 (x_offset, y_offset), 'Getting started', colour='white',
39 (x_offset, y_offset), 'How to play', colour='white', centre=True)
40 howto.add_callback('click', self.howto_scene)
45 (x_offset, y_offset), 'Introductory Level', colour='white',
47 intro.add_callback('click', self.introduction_level)
52 (x_offset, y_offset), 'Press ESC to return to the main menu.',
53 colour='white', centre=True)
56 def howto_scene(self, event):
57 SceneChangeEvent.post(HowtoScene)
59 def introduction_level(self, event):
60 from naja.scenes.game import GameScene
61 LoadGameEvent.post(state=GameState.new(deck='introduction'))
62 SceneChangeEvent.post(GameScene)
64 def handle_scene_event(self, ev):
65 if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT:
66 from naja.scenes.menu import MenuScene
67 SceneChangeEvent.post(MenuScene)