Display some info about the current tile
[naja.git] / naja / scenes / game.py
1 """
2 Gameboard scene.
3 """
4
5 import pygame.locals as pgl
6
7 from naja.events import SceneChangeEvent
8 from naja.scenes.scene import Scene
9 from naja.widgets.board import BoardWidget
10 from naja.widgets.player_bits import PlayerBitsWidget
11 from naja.widgets.game_bits import GameBitsWidget
12 from naja.widgets.info_area import InfoAreaWidget
13 from naja.widgets.robot import RobotWidget
14
15
16 class GameScene(Scene):
17     """
18     Gameboard scene.
19     """
20
21     def __init__(self, state):
22         super(GameScene, self).__init__(state)
23         self.add(PlayerBitsWidget((0, 0), state))
24         self.add(BoardWidget((0, 60), state))
25         self.add(GameBitsWidget((0, 540), state))
26         self.add(InfoAreaWidget((480, 0), state))
27         self.add(RobotWidget(state))
28
29     def handle_scene_event(self, ev):
30         from naja.scenes.menu import MenuScene
31         if ev.type == pgl.KEYUP and ev.key in (pgl.K_q, pgl.K_ESCAPE):
32             SceneChangeEvent.post(MenuScene)
33             return