Mercurial > zrpn
changeset 47:f6e93c83532f
Use load_board on display
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sat, 07 Jul 2012 18:18:41 +0200 |
| parents | 02d26987c201 |
| children | 60fab20f67b0 |
| files | zrpn/client.py zrpn/display.py zrpn/main.py |
| diffstat | 3 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/zrpn/client.py Sat Jul 07 18:15:42 2012 +0200 +++ b/zrpn/client.py Sat Jul 07 18:18:41 2012 +0200 @@ -8,13 +8,12 @@ import pygame_network as net import pygame_network.event -import board import display import packets class Client(object): def __init__(self, address, port): - self.display = None + self.display = display.Display() self.connected = False self.client = net.Client() self.connection = self.client.connect(address, port) @@ -30,7 +29,8 @@ elif event.type == net.event.NETWORK: if event.net_type == net.event.NET_RECEIVED: if event.p_type == packets.INIT: - self.display.Display(event.packet.board, event.packet.sprites) + self.display.load_board(event.packet.board, + event.packet.sprites) elif event.net_type == packets.ANIMATION: self.display.do_animations((event.packet,)) self.display.frame()
--- a/zrpn/display.py Sat Jul 07 18:15:42 2012 +0200 +++ b/zrpn/display.py Sat Jul 07 18:18:41 2012 +0200 @@ -7,11 +7,14 @@ class Display(object): - def __init__(self, board, board_ids): + def __init__(self): pygame.display.init() self.screen = pygame.display.set_mode((800, 600)) self.screen.fill((0x33, 0x33, 0x33)) self.background = self.screen.copy() + + + def load_board(self, board, board_ids): self.sprites = pygame.sprite.LayeredDirty() self.cids = {} for y, line in enumerate(board):
--- a/zrpn/main.py Sat Jul 07 18:15:42 2012 +0200 +++ b/zrpn/main.py Sat Jul 07 18:18:41 2012 +0200 @@ -11,7 +11,8 @@ class Game(object): def __init__(self): self.board = board.Board() - self.display = display.Display(self.board.board, self.board.cells) + self.display = display.Display() + self.display.load_board(self.board.board, self.board.cells) def run(self): animations = self.board.update()
