From 9674738abc8984d15b55418e52718ac28669cc7d Mon Sep 17 00:00:00 2001 From: Daniel Francis Date: Fri, 21 Dec 2012 14:18:54 +0000 Subject: Activity completely ported to sugargame with no regressions Signed-off-by: Daniel Francis --- (limited to 'physics.py') diff --git a/physics.py b/physics.py index 18aa7eb..5f80527 100644 --- a/physics.py +++ b/physics.py @@ -55,6 +55,7 @@ class PhysicsGame: self.currentTool = self.toolList[tools.allTools[0].name] # Set up the world (instance of Elements) self.box2d = box2d + self.opening_queue = None def switch_off_fake_pygame_cursor_cb(self, panel, event): self.show_fake_cursor = False @@ -62,6 +63,15 @@ class PhysicsGame: def switch_on_fake_pygame_cursor_cb(self, panel, event): self.show_fake_cursor = True + def write_file(self, path): + #Saving to journal + self.world.add.remove_mouseJoint() + self.world.json_save(path) + + def read_file(self, path): + #Loading from journal + self.opening_queue = path + def run(self): self.screen = pygame.display.get_surface() pygame.display.init() @@ -88,6 +98,9 @@ class PhysicsGame: while gtk.events_pending(): gtk.main_iteration() + if self.opening_queue: + self.world.json_load(self.opening_queue) + for event in pygame.event.get(): self.currentTool.handleEvents(event) if event.type == MOUSEBUTTONUP: -- cgit v0.9.1