+ def enter(self, gamestate):
+ if gamestate.station is None:
+ print "Loading Station Alpha ..."
+ gamestate.set_station(loader.load_station("station-alpha.json"))
+ font_title = loader.load_font(FONTS['bold'], size=32)
+ self._title = font_title.render('A Game with a title', True,
+ (255, 255, 255))
+ self._menu = [
+ TextButton("Load Level", (255, 255, 255), name='load level'),
+ TextButton("Start Game (Day)", (255, 255, 255), name='start game'),
+ TextButton("Load Saved Game", (255, 255, 255), name='load game'),
+ ]
+
+ def render(self, surface, gamestate):
+ surface.fill((0, 128, 0))
+
+ pos = ((surface.get_width() - self._title.get_width()) / 2, 50)
+ surface.blit(self._title, pos, None)
+
+ height = 150
+ for item in self._menu:
+ if not item.position:
+ item.position = ((surface.get_width() - item.get_width()) / 2,
+ height)
+ item.render(surface)
+ height += item.get_height() + 30
+
+ def _get_pressed(self, ev):
+ for button in self._menu:
+ if button.pressed(ev):
+ return button.name
+ return None
+
+ def _do_day(self):
+ from .day import DayScene
+ SceneChangeEvent.post(scene=DayScene())
+
+ def _do_load_level(self):
+ from .load_level import LoadLevelScene
+ SceneChangeEvent.post(scene=LoadLevelScene())
+