Set a window icon and title
[naja.git] / naja / scenes / win.py
1 """
2 Win scene.
3 """
4
5 import pygame.locals as pgl
6
7 from naja.constants import KEYS, PALETTE
8 from naja.events import QuitGameEvent
9 from naja.options import options
10 from naja.scenes.scene import Scene
11 from naja.widgets.text import TextWidget, TextBoxWidget
12
13
14 class WinScene(Scene):
15     """
16     Congratulations.
17     """
18
19     def __init__(self, state):
20         super(WinScene, self).__init__(state)
21         self.add(TextWidget((50, 50), 'You won!', colour=PALETTE.WHITE))
22         if options.cheat_enabled:
23             self.add(TextWidget(
24                 (50 + 64, 50), 'CHEATER!', colour=PALETTE.ORANGE))
25         self.add(TextBoxWidget(
26             (50, 100), '\n'.join([
27                 "You're great.",
28                 "You did well.",
29                 "You should be proud of yourself.",
30             ]),
31             colour=PALETTE.WHITE, padding=1, border=1,
32             bg_colour=PALETTE.BLACK, border_colour=PALETTE.BLACK,
33             box_width=300))
34
35     def handle_scene_event(self, ev):
36         if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT:
37             QuitGameEvent.post()
38             return