[Sugar-devel] [PATCH Maze 4/4] Save and restore state of the game
James Cameron
quozl at laptop.org
Wed Mar 21 18:27:04 EDT 2012
On Tue, Mar 20, 2012 at 10:52:54PM -0300, Manuel Kaufmann wrote:
> Ability to 'save' (when the user closes the Activity) and 'restore' (when the
> user launch it from the Journal or the Home without holding Alt) the state of
> the game.
>
> For this ability I had to upgrade 'olpcgames' to 1.6 because
> 'olpcgames.FILE_READ_REQUEST' and 'olpcgames.FILE_WRITE_REQUEST' events are
> added in that version and those events are needed for this.
>
> The data is saved (as JSON, with simplejson module) in the 'event.filename'
> path using the 'sugar.datastore' API.
>
> A filename example is:
>
> ~/.sugar/default/datastore/09/0940b7eb-1cb7-4687-aa7a-ac2c174dcfd7/data
>
> This commit solves ticket #2393:
> * http://bugs.sugarlabs.org/ticket/2393
Reviewed-by: James Cameron <quozl at laptop.org>
Contrary to Gonzalo, I don't think the olpcgames and game.py changes
should be separated, since they are entirely interdependent. Applying
one change or the other does not lead to working code. Both are
required.
--
James Cameron
http://quozl.linux.org.au/
More information about the Sugar-devel
mailing list