Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
authorGary Martin <gary@garycmartin.com>2010-10-06 17:56:32 (GMT)
committer Gary Martin <gary@garycmartin.com>2010-10-06 17:56:32 (GMT)
commit6be1dada2fde0e8e06220c9c509338c350123f0d (patch)
tree11843e9e6241b55e9b2666b9f46d7b851f0932e4 /tools.py
parenta45bd81c6e7bf30d7c598c291578960a2f9b2db8 (diff)
Watch for focus events so that pygame run loop is more gracefully idle when in background.
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools.py b/tools.py
index 75a3440..c3877b9 100644
--- a/tools.py
+++ b/tools.py
@@ -48,6 +48,10 @@ class Tool(object):
if event.action == "stop_start_toggle":
# Stop/start simulation
self.game.world.run_physics = not self.game.world.run_physics
+ elif event.action == "focus_in":
+ self.game.in_focus = True
+ elif event.action == "focus_out":
+ self.game.in_focus = False
elif self.game.toolList.has_key(event.action):
self.game.setTool(event.action)
elif hasattr(event,"code"):