Mercurial > rinkhals
diff gamelib/engine.py @ 12:8a7319e4853a
Hooked in the game board.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 30 Aug 2009 15:20:17 +0000 |
parents | 5d58a5b13731 |
children | d7f295c06a4b |
line wrap: on
line diff
--- a/gamelib/engine.py Sun Aug 30 15:11:44 2009 +0000 +++ b/gamelib/engine.py Sun Aug 30 15:20:17 2009 +0000 @@ -4,6 +4,8 @@ import pygame from pygame.locals import USEREVENT, QUIT, KEYDOWN, K_ESCAPE +import gameboard + class Engine(Game): def __init__(self, main_menu_app): self.main_menu_app = main_menu_app @@ -13,9 +15,13 @@ """Tic toc.""" pygame.time.wait(10) + def create_game_board(self): + self.gameboard = gameboard.GameBoard() + class MainMenuState(State): def event(self, e): if events_equal(e, START_DAY): + self.game.create_game_board() return DayState(self.game) elif e.type is KEYDOWN and e.key == K_ESCAPE: return Quit(self.game) @@ -36,6 +42,17 @@ elif events_equal(e, GO_MAIN_MENU): return MainMenuState(self.game) + def paint(self, screen): + self.game.gameboard.paint(screen) + pygame.display.flip() + + def update(self, screen): + update = self.game.gameboard.update(screen) + pygame.display.update(update) + + def loop(self): + self.game.gameboard.loop() + class NightState(State): def event(self, e): if events_equal(e, START_DAY):