7 import pygame.locals as pgl
9 from naja.constants import KEYS, FPS
10 from naja.scenes.scene import Scene
11 from naja.widgets.text import TextWidget, TextBoxWidget
12 from naja.widgets.image_box import ImageBox
13 from naja.events import SceneChangeEvent
16 class CreditsScene(Scene):
18 List those responsible.
21 def __init__(self, state):
22 super(CreditsScene, self).__init__(state)
25 background = ImageBox(
26 (0, 0), "screens/splash.png")
29 (400, 300), 'CREDITS', colour='white', centre=True))
31 self.credits = TextBoxWidget(
32 (400, 340), '\n'.join([
33 'A game about robots and bits and other things',
37 u'Adrianna PiĆska, David Sharpe, Jeremy Thurgood, '
38 u'Neil Muller, Simon Cross & Stefano Rivera',
43 'for snacks and tutorial inspiration',
45 'Bearnard Hibbins, Graham Inggs,',
46 'and William Stewart',
47 'for playtesting and finding bugs',
49 'Music by Rolemusic:',
50 'http://rolemusic.sawsquarenoise.com/',
52 'Out of credits. Insert coin.',
53 '(Press ESC to return to the menu.)',
55 colour='white', padding=1,
56 bg_colour=(0, 0, 0, 0), centre=True,
57 box_width=780, view_port=(780, 250))
58 self.add(self.credits)
60 def render_scene(self, surface):
61 if self.autoscroll is not None:
63 if self.autoscroll >= 1.5 * FPS:
64 fake_event = pygame.event.Event(pgl.KEYDOWN, key=pgl.K_DOWN)
65 self.credits.handle_event(fake_event)
68 def handle_event(self, ev):
69 if ev.type == pgl.KEYDOWN:
70 self.autoscroll = None
71 return super(CreditsScene, self).handle_event(ev)
73 def handle_scene_event(self, ev):
74 if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT:
75 from naja.scenes.menu import MenuScene
76 SceneChangeEvent.post(MenuScene)