160 likes | 319 Views
Creating a pygame bundle. What is a bundle activity.info Activity Icon activity.py Custom Data Saved Data Rolling a bundle Testing bundles. Bundles. https://coderanger.net/svn/projects/olpc/games/Example.activity/ MyGame .activity/ activity/ activity.info activity- mygame .svg data/
E N D
Creating a pygame bundle • What is a bundle • activity.info • Activity Icon • activity.py • Custom Data • Saved Data • Rolling a bundle • Testing bundles
Bundles • https://coderanger.net/svn/projects/olpc/games/Example.activity/ • MyGame.activity/ • activity/ • activity.info • activity-mygame.svg • data/ • sounds! images! music! • activity.py • mygame.py • ...
Creating an Icon • Option 1: Steal it
Creating an Icon • Option 1: Steal it • Option 2: Create one • Create SVG (start with existing icon) • Edit SVG to conform to specs • http://wiki.laptop.org/go/Sugar_Icon_Format
[Activity] name = My Game activity_version = 1 host_version = 1 service_name = org.yourgroup.olpc.MyGame icon = activity-mygame class = activity.MyGameActivity activity.info
import olpcgames class MyGameActivity(olpcgames.PyGameActivity): """An example of using a Pygame game as a Sugar activity.""" game_name = 'mygame' # Alternately, #game_name = 'mygame:mymainfunction' game_title = 'My Game' #game_size = (1200, 825) activity.py
No absolute path names! We can't know ahead of time where we are installed from olpcgames.util import data_pathfull_path = data_path(relativefilename) Custom Data
Saved Data • Not Done Yet
Saved Data • Not Done Yet • Just for now,import sugar.envos.path.join(sugar.env.get_profile_path(), 'mygame') • This will go away one the datastore is finished.
Create the bundle • zip -r MyGame-[version].xo MyGame.activity
Testing Bundles • Changed activity.info? • restart X • Activity launched successfully? • kill the sugar-activity-factory • Developer mode: alt - = • /home/olpc/.sugar/default/logs • A better way:$ sugar-activity “My Game”
Getting Help • #olpc-gamejam • I'm 'ywwg'