Gameboard scene.
"""
+import pygame.locals as pgl
+
from .scene import Scene
+from .menu import MenuScene
+
+from naja.widgets.board import BoardWidget
+from naja.widgets.player_bits import PlayerBitsWidget
+from naja.widgets.game_bits import GameBitsWidget
+from naja.widgets.info_area import InfoAreaWidget
+
+from naja.events import SceneChangeEvent
class GameScene(Scene):
"""
Gameboard scene.
"""
+
+ def __init__(self):
+ super(GameScene, self).__init__()
+ self.widgets.append(PlayerBitsWidget())
+ self.widgets.append(BoardWidget())
+ self.widgets.append(GameBitsWidget())
+ self.widgets.append(InfoAreaWidget())
+
+ def handle_event(self, ev):
+ if ev.type == pgl.KEYUP and ev.key in (pgl.K_q, pgl.K_ESCAPE):
+ SceneChangeEvent.post(scene=MenuScene())
+ return
--- /dev/null
+"""
+Widget that holds the game tiles.
+"""
+
+from .base import Widget
+
+
+class BoardWidget(Widget):
+ """
+ Widget which holds all the tiles that make up the gameboard.
+ """
+ def __init__(self, pos, image=None):
+ super(BoardWidget, self).__init__(pos, (96, 96))
+
+ def prepare(self):
+ pass
+
+ def draw(self, surface):
+ surface.blit(self.surface, self.rect)
--- /dev/null
+"""
+Widget that holds the games's bits.
+"""
+
+from .base import Widget
+
+
+class GameBitsWidget(Widget):
+ """
+ Widget which holds the game's bits.
+ """
+ def __init__(self, pos, image=None):
+ super(GameBitsWidget, self).__init__(pos, (96, 96))
+
+ def prepare(self):
+ pass
+
+ def draw(self, surface):
+ surface.blit(self.surface, self.rect)
--- /dev/null
+"""
+Widget for the game board information area.
+"""
+
+from .base import Widget
+
+
+class InfoAreaWidget(Widget):
+ """
+ Widget for the game board information area.
+ """
+ def __init__(self, pos, image=None):
+ super(InfoAreaWidget, self).__init__(pos, (96, 96))
+
+ def prepare(self):
+ pass
+
+ def draw(self, surface):
+ surface.blit(self.surface, self.rect)
--- /dev/null
+"""
+Widget that holds the player's bits.
+"""
+
+from .base import Widget
+
+
+class PlayerBitsWidget(Widget):
+ """
+ Widget which holds the player's bits.
+ """
+ def __init__(self, pos, image=None):
+ super(PlayerBitsWidget, self).__init__(pos, (96, 96))
+
+ def prepare(self):
+ pass
+
+ def draw(self, surface):
+ surface.blit(self.surface, self.rect)