From d121ad18c7e21bc7a084654b8807359f66b2d32b Mon Sep 17 00:00:00 2001 From: Kshitij Kumar Date: Mon, 07 Jan 2013 13:33:42 +0000 Subject: activity.py fixes --- 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")) -- cgit v0.9.1