That was too fast
[naja.git] / naja / scenes / credits.py
index a6ae05d2b6ce1de404332d50fe48cc7a7753b67d..b3fd4bd0c1c752ee58e7d13d78a948c9e67b8eb3 100644 (file)
@@ -1,10 +1,12 @@
+# coding: UTF-8
 """
 Credits scene.
 """
 
+import pygame
 import pygame.locals as pgl
 
-from naja.constants import KEYS
+from naja.constants import KEYS, FPS
 from naja.scenes.scene import Scene
 from naja.widgets.text import TextWidget, TextBoxWidget
 from naja.widgets.image_box import ImageBox
@@ -18,6 +20,7 @@ class CreditsScene(Scene):
 
     def __init__(self, state):
         super(CreditsScene, self).__init__(state)
+        self.autoscroll = 0
 
         background = ImageBox(
             (0, 0), "screens/splash.png")
@@ -25,23 +28,47 @@ class CreditsScene(Scene):
         self.add(TextWidget(
             (400, 300), 'CREDITS', colour='white', centre=True))
 
-        self.add(TextBoxWidget(
+        self.credits = TextBoxWidget(
             (400, 340), '\n'.join([
                 'A game about robots and bits and other things',
                 '',
                 'by',
                 '',
-                'Adrianna Pinska, David Sharpe, Jeremy Thurgood, '
-                'Neil Muller, Simon Cross & Stefano Rivera',
+                u'Adrianna PiƄska, David Sharpe, Jeremy Thurgood, '
+                u'Neil Muller, Simon Cross & Stefano Rivera',
+                '',
+                'Special thanks to:',
+                '',
+                'Desilu Crossman',
+                'for snacks and tutorial inspiration',
+                '',
+                'Bearnard Hibbins, Graham Inggs,',
+                'and William Stewart',
+                'for playtesting and finding bugs',
                 '',
                 'Music by Rolemusic:',
                 'http://rolemusic.sawsquarenoise.com/',
                 '',
-                'Press ESC to return to the menu.',
+                'Out of credits. Insert coin.',
+                '(Press ESC to return to the menu.)',
             ]),
             colour='white', padding=1,
             bg_colour=(0, 0, 0, 0), centre=True,
-            box_width=780, view_port=(780, 250)))
+            box_width=780, view_port=(780, 250))
+        self.add(self.credits)
+
+    def render_scene(self, surface):
+        if self.autoscroll is not None:
+            self.autoscroll += 1
+        if self.autoscroll >= 1.5 * FPS:
+            fake_event = pygame.event.Event(pgl.KEYDOWN, key=pgl.K_DOWN)
+            self.credits.handle_event(fake_event)
+            self.autoscroll = 0
+
+    def handle_event(self, ev):
+        if ev.type == pgl.KEYDOWN:
+            self.autoscroll = None
+        return super(CreditsScene, self).handle_event(ev)
 
     def handle_scene_event(self, ev):
         if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT: