5 import pygame.locals as pgl
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
16 class GameScene(Scene):
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))
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)