Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Deaton <rdeaton@udel.edu>2012-09-19 16:33:37 (GMT)
committer Robert Deaton <rdeaton@udel.edu>2012-09-19 16:33:37 (GMT)
commit4f54959d3a7fb67b5f2299221c5a9160904b2520 (patch)
tree5acd3ea2c6269c51ad8843ed516b55be342a65d8
parent5af2f60fbf3d56139a03db714699e165d72afe5d (diff)
Move everything up one directory. Beyond this change, we should keep in sync with the main repository.v0.1submodule-friendly
Signed-off-by: Robert Deaton <rdeaton@udel.edu>
-rw-r--r--README.txt137
-rw-r--r--__init__.py (renamed from sugargame/__init__.py)0
-rw-r--r--canvas.py (renamed from sugargame/canvas.py)0
-rw-r--r--event.py (renamed from sugargame/event.py)0
-rw-r--r--test/TestActivity.py68
-rwxr-xr-xtest/TestGame.py82
-rw-r--r--test/activity/activity-generic.svg23
-rwxr-xr-xtest/activity/activity.info6
-rw-r--r--test/activity/mimetypes.xml8
-rwxr-xr-xtest/setup.py4
10 files changed, 0 insertions, 328 deletions
diff --git a/README.txt b/README.txt
deleted file mode 100644
index c0ac366..0000000
--- a/README.txt
+++ /dev/null
@@ -1,137 +0,0 @@
-== Sugargame ==
-
-Sugargame is a Python package which allows [http://www.pygame.org/ Pygame]
-programs to run well under Sugar.
-It is fork of the olcpgames framework, which is no longer maintained.
-
-http://git.sugarlabs.org/projects/sugargame
-
-What it does:
-
-* Wraps a Sugar activity around an existing Pygame program with few changes
-* Allows Sugar toolbars and other widgets to be added to the activity UI
-* Provides hooks for saving to and restoring from the Journal
-
-==== Differences between Sugargame and olpcgames ====
-
-The olpcgames framework provides a wrapper around Pygame which attempts to
-allow a Pygame program to run mostly unmodified under Sugar. To this end,
-the Pygame program is run in a separate thread with its own Pygame message
-loop while the main thread runs the GTK message loop. Also, olpcgames wraps
-Sugar APIs such as the journal and mesh into a Pygame-like API.
-
-Sugargame takes a simpler approach; it provides a way to embed Pygame into a
-GTK widget. The Sugar APIs are used to interact with Sugar, the Pygame APIs
-are used for the game.
-
-Sugargame advantages:
-
-* Simpler code
-* More elegant interface between Pygame and GTK
-* Runs as a single thread: no thread related segfaults
-* Possible to use Sugar widgets with Pygame
-
-Sugargame limitations:
-
-* No support for Pango or SVG sprites (yet)
-
-== Using Sugargame ==
-
-See also [[Development Team/Sugargame/Examples]].
-
-==== Wrapping 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:
-
- activity/ - Activity directory: activity.info, SVG icon, etc.
- sugargame/ - Sugargame package
- MyActivity.py - Activity class
- mygame.py - Pygame code
- setup.py - Install script
-
-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.
-Pass the main loop function of the Pygame program.
-
- 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 a PyGTK activity ====
-
-To add Pygame to an existing Sugar activity, create a PygameCanvas widget and call
-run_pygame on it.
-
- widget = sugargame.canvas.PygameCanvas(self)
- vbox.pack_start(widget)
-
- widget.run_pygame(self.game.run)
-
-Due to limitations of Pygame and SDL, there can only be one PygameCanvas in the
-entire activity.
-
-The argument to run_pygame is a function structured like a Pygame program. In the
-main loop, remember to dispatch GTK messages using gtk.main_iteration().
-
- def main_loop():
- clock = pygame.time.Clock()
- screen = pygame.display.get_surface()
-
- while self.running:
- # Pump GTK messages.
- while gtk.events_pending():
- gtk.main_iteration()
-
- # Pump PyGame messages.
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- return
- elif event.type == pygame.VIDEORESIZE:
- pygame.display.set_mode(event.size, pygame.RESIZABLE)
-
- # Check the mouse position
- x, y = pygame.mouse.get_pos()
-
- # Clear Display
- screen.fill((255,255,255)) #255 for white
-
- # Draw stuff here
- .................
-
- # Flip Display
- pygame.display.flip()
-
- # Try to stay at 30 FPS
- self.clock.tick(30)
-
-== Support ==
-
-For help with Sugargame, please email the Sugar Labs development list:
-
-: sugar-devel@lists.sugarlabs.org
-
-Sugargame is developed by Wade Brainerd <wadetb@gmail.com>.
-
-It is loosely based on the source code to the olpcgames framework, developed by
-the One Laptop Per Child project.
-
-=== Changelog ===
-
-====v1.1====
-* Fix bugs in event handling. (Pablo Moleri)
-* Remove reference to gtk.Socket.get_window() method, which is missing in older versions of PyGTK.
-
-====v1.0====
-* Initial version of Sugargame
diff --git a/sugargame/__init__.py b/__init__.py
index 439eb0c..439eb0c 100644
--- a/sugargame/__init__.py
+++ b/__init__.py
diff --git a/sugargame/canvas.py b/canvas.py
index 980cb73..980cb73 100644
--- a/sugargame/canvas.py
+++ b/canvas.py
diff --git a/sugargame/event.py b/event.py
index 6676813..6676813 100644
--- a/sugargame/event.py
+++ b/event.py
diff --git a/test/TestActivity.py b/test/TestActivity.py
deleted file mode 100644
index fcd4262..0000000
--- a/test/TestActivity.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from gettext import gettext as _
-
-import sys
-import gtk
-import pygame
-
-import sugar.activity.activity
-import sugar.graphics.toolbutton
-
-sys.path.append('..') # Import sugargame package from top directory.
-import sugargame.canvas
-
-import TestGame
-
-class TestActivity(sugar.activity.activity.Activity):
- def __init__(self, handle):
- super(TestActivity, self).__init__(handle)
-
- self.paused = False
-
- # Create the game instance.
- self.game = TestGame.TestGame()
-
- # Build the activity toolbar.
- self.build_toolbar()
-
- # Build the Pygame canvas.
- self._pygamecanvas = sugargame.canvas.PygameCanvas(self)
-
- # Note that set_canvas implicitly calls read_file when resuming from the Journal.
- self.set_canvas(self._pygamecanvas)
-
- # Start the game running (self.game.run is called when the activity constructor returns).
- self._pygamecanvas.run_pygame(self.game.run)
-
- def build_toolbar(self):
- stop_play = sugar.graphics.toolbutton.ToolButton('media-playback-stop')
- stop_play.set_tooltip(_("Stop"))
- stop_play.set_accelerator(_('<ctrl>space'))
- stop_play.connect('clicked', self._stop_play_cb)
-
- toolbar = gtk.Toolbar()
- toolbar.insert(stop_play, 0)
-
- toolbox = sugar.activity.activity.ActivityToolbox(self)
- toolbox.add_toolbar(_("Pygame"), toolbar)
-
- toolbox.show_all()
- self.set_toolbox(toolbox)
-
- def _stop_play_cb(self, button):
- # Pause or unpause the game.
- self.paused = not self.paused
- self.game.set_paused(self.paused)
-
- # Update the button to show the next action.
- if self.paused:
- button.set_icon('media-playback-start')
- button.set_tooltip(_("Start"))
- else:
- button.set_icon('media-playback-stop')
- button.set_tooltip(_("Stop"))
-
- def read_file(self, file_path):
- self.game.read_file(file_path)
-
- def write_file(self, file_path):
- self.game.write_file(file_path)
diff --git a/test/TestGame.py b/test/TestGame.py
deleted file mode 100755
index d9dbc2e..0000000
--- a/test/TestGame.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/python
-import pygame
-import gtk
-
-class TestGame:
- def __init__(self):
- # Set up a clock for managing the frame rate.
- self.clock = pygame.time.Clock()
-
- self.x = -100
- self.y = 100
-
- self.vx = 10
- self.vy = 0
-
- self.paused = False
-
- def set_paused(self, paused):
- self.paused = paused
-
- # Called to save the state of the game to the Journal.
- def write_file(self, file_path):
- pass
-
- # Called to load the state of the game from the Journal.
- def read_file(self, file_path):
- pass
-
- # The main game loop.
- def run(self):
- self.running = True
-
- screen = pygame.display.get_surface()
-
- while self.running:
- # Pump GTK messages.
- while gtk.events_pending():
- gtk.main_iteration()
-
- # Pump PyGame messages.
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- return
- elif event.type == pygame.VIDEORESIZE:
- pygame.display.set_mode(event.size, pygame.RESIZABLE)
-
- # Move the ball
- if not self.paused:
- self.x += self.vx
- if self.x > screen.get_width() + 100:
- self.x = -100
-
- self.y += self.vy
- if self.y > screen.get_height() - 100:
- self.y = screen.get_height() - 100
- self.vy = -self.vy
-
- self.vy += 5;
-
- # Clear Display
- screen.fill((255,255,255)) #255 for white
-
- # Draw the ball
- pygame.draw.circle(screen, (255,0,0), (self.x, self.y), 100)
-
- # Flip Display
- pygame.display.flip()
-
- # Try to stay at 30 FPS
- self.clock.tick(30)
-
-# This function is called when the game is run directly from the command line:
-# ./TestGame.py
-def main():
- pygame.init()
- pygame.display.set_mode((0, 0), pygame.RESIZABLE)
- game = TestGame()
- game.run()
-
-if __name__ == '__main__':
- main()
-
diff --git a/test/activity/activity-generic.svg b/test/activity/activity-generic.svg
deleted file mode 100644
index 3a642f8..0000000
--- a/test/activity/activity-generic.svg
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" ?><!-- Created with Inkscape (http://www.inkscape.org/) --><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
- <!ENTITY stroke_color "#ff0000">
- <!ENTITY fill_color "#000000">
-]><svg height="55" id="svg2" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:version="0.46+devel" sodipodi:docname="activity-generic.svg" sodipodi:version="0.32" style="" version="1.0" width="55" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
- <metadata id="metadata20">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <sodipodi:namedview bordercolor="#666666" borderopacity="1" gridtolerance="10" guidetolerance="10" id="namedview18" inkscape:current-layer="svg2" inkscape:cx="-15.963983" inkscape:cy="27.5" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="1125" inkscape:window-width="1920" inkscape:window-x="0" inkscape:window-y="25" inkscape:zoom="4.2909091" objecttolerance="10" pagecolor="#ffffff" showgrid="true">
- <inkscape:grid id="grid796" type="xygrid"/>
- </sodipodi:namedview>
- <defs id="defs4" style="">
- <inkscape:perspective id="perspective22" inkscape:persp3d-origin="27.5 : 18.333333 : 1" inkscape:vp_x="0 : 27.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="55 : 27.5 : 1" sodipodi:type="inkscape:persp3d"/>
- </defs>
- <g id="layer1" style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-opacity:1;stroke-width:3.002554;stroke-miterlimit:4;stroke-dasharray:none" transform="matrix(1.1689037,0,0,1.1624538,-4.6448521,-4.3634813)">
- <rect height="35" id="rect16" style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:3.002554;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" width="35" x="10" y="10"/>
- <text id="text790" style="font-size:40px;font-style:normal;font-weight:normal;fill:&stroke_color;;fill-opacity:1;stroke:none;stroke-opacity:1;font-family:Bitstream Vera Sans;stroke-width:3.00255399999999995;stroke-miterlimit:4;stroke-dasharray:none" x="17.911133" xml:space="preserve" y="40"><tspan id="tspan792" style="font-size:36px;fill:&stroke_color;;fill-opacity:1;stroke:none;stroke-opacity:1;stroke-width:3.00255399999999995;stroke-miterlimit:4;stroke-dasharray:none" x="17.911133" y="40">?</tspan></text>
- </g>
-</svg> \ No newline at end of file
diff --git a/test/activity/activity.info b/test/activity/activity.info
deleted file mode 100755
index 313c30d..0000000
--- a/test/activity/activity.info
+++ /dev/null
@@ -1,6 +0,0 @@
-[Activity]
-name = SugargameTest
-service_name = org.sugarlabs.SugargameTest
-class = TestActivity.TestActivity
-icon = activity-generic
-activity_version = 1
diff --git a/test/activity/mimetypes.xml b/test/activity/mimetypes.xml
deleted file mode 100644
index 8fe1709..0000000
--- a/test/activity/mimetypes.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
- <mime-type type="application/x-physics-activity">
- <comment xml:lang="en">Physics Activity</comment>
- <glob pattern="*.physics"/>
- </mime-type>
-</mime-info>
-
diff --git a/test/setup.py b/test/setup.py
deleted file mode 100755
index 6ed89aa..0000000
--- a/test/setup.py
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env python
-from sugar.activity import bundlebuilder
-bundlebuilder.start()
-