diff options
author | Kshitij Kumar <kshitijakumar@gmail.com> | 2013-01-07 13:33:42 (GMT) |
---|---|---|
committer | Kshitij Kumar <kshitijakumar@gmail.com> | 2013-01-07 13:33:42 (GMT) |
commit | d121ad18c7e21bc7a084654b8807359f66b2d32b (patch) | |
tree | 8cd36ed4430ad0cf6c31ccd075e65dd5a5650e2e | |
parent | 811848ba7449d4657ea2840116f95085834e543c (diff) |
activity.py fixes
-rwxr-xr-x | activity.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/activity.py b/activity.py index 127e73f..4f53837 100755 --- a/activity.py +++ b/activity.py @@ -1,9 +1,11 @@ # -*- coding: utf-8 -*- import logging -import olpcgames +import sugargame +import sugargame.canvas import pygame import gtk +import maze from olpcgames import mesh from olpcgames import util @@ -15,13 +17,20 @@ from sugar.graphics.toolbutton import ToolButton from gettext import gettext as _ -class MazeActivity(olpcgames.PyGameActivity): +class MazeActivity(activity.Activity): game_name = 'game' game_title = _('Maze') game_size = None # Let olpcgames pick a nice size for us def __init__(self, handle): super(MazeActivity, self).__init__(handle) + # Build the Pygame canvas. + self._canvas = sugargame.canvas.PygameCanvas(self) + self.game = maze.main(self) + self.build_toolbar() + self.set_canvas(self._canvas) + # Start the game running. + self._canvas.run_pygame(self.game.run) # This code was copied from olpcgames.activity.PyGameActivity def shared_cb(*args, **kwargs): @@ -95,9 +104,9 @@ class MazeActivity(olpcgames.PyGameActivity): return toolbar_box def _easier_button_cb(self, button): - pygame.event.post(olpcgames.eventwrap.Event( - pygame.USEREVENT, action='easier_button')) + pygame.event.post(pygame.event.Event(pygame.USEREVENT, + action="easier_button")) def _harder_button_cb(self, button): - pygame.event.post(olpcgames.eventwrap.Event( - pygame.USEREVENT, action='harder_button')) + pygame.event.post(pygame.event.Event(pygame.USEREVENT, + action="harder_button")) |