Development Team/Sugargame: Difference between revisions
| Line 32: | Line 32: | ||
== Using Sugargame == | == Using Sugargame == | ||
To use Sugargame | === Porting a Pygame program === | ||
To use Sugargame to Sugarize a Pygame program, set up an activity directory and copy the Sugargame package to it. | |||
The activity directory should look something like this: | The activity directory should look something like this: | ||
| Line 42: | Line 43: | ||
mygame.py - Pygame code | mygame.py - Pygame code | ||
setup.py - Install script | setup.py - Install script | ||
To make the Activity class, start with test/TestActivity.py. | To make the Activity class, start with test/TestActivity.py from the Sugargame distribution. | ||
The activity should create a single PygameCanvas widget and call run_pygame on it. | |||
self._canvas = sugargame.canvas.PygameCanvas(self) | |||
self.set_canvas(self._canvas) | |||
# Start the game running. | |||
self._canvas.run_pygame(self.game.run) | |||
In your Pygame main loop, pump the GTK message loop: | |||
while gtk.events_pending(): | |||
gtk.main_iteration() | |||
=== Adding Pygame to an activity === | |||
TODO | |||
== Support == | == Support == | ||