From 3bc46992bfb9a607e5e6ea38aafc98157d3e5f92 Mon Sep 17 00:00:00 2001 From: Walter Korman Date: Wed, 22 May 2002 01:56:25 +0000 Subject: [PATCH] Set a flag to note whether we're paused and check the flag to avoid ticking when paused rather than un-registering and re-registering ourselves as a frame participant to effect same. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1383 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/media/MediaPanel.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/media/MediaPanel.java b/src/java/com/threerings/media/MediaPanel.java index 204c0387b..8528e57e2 100644 --- a/src/java/com/threerings/media/MediaPanel.java +++ b/src/java/com/threerings/media/MediaPanel.java @@ -1,5 +1,5 @@ // -// $Id: MediaPanel.java,v 1.7 2002/05/17 21:11:34 mdb Exp $ +// $Id: MediaPanel.java,v 1.8 2002/05/22 01:56:25 shaper Exp $ package com.threerings.media; @@ -130,16 +130,11 @@ public class MediaPanel extends JComponent return; } - if (paused) { - // stop listening to the frame tick - _framemgr.removeFrameParticipant(this); + if (_paused = paused) { // make a note of our pause time _pauseTime = System.currentTimeMillis(); } else { - // start listening to the frame tick once again - _framemgr.registerFrameParticipant(this); - // let the animation and sprite managers know that we just // warped into the future long delta = System.currentTimeMillis() - _pauseTime; @@ -258,6 +253,11 @@ public class MediaPanel extends JComponent // documentation inherited from interface public void tick (long tickStamp) { + // bail if ticking is currently disabled + if (_paused) { + return; + } + int width = getWidth(), height = getHeight(); // if scrolling is enabled, determine the scrolling delta to be @@ -555,6 +555,9 @@ public class MediaPanel extends JComponent /** Used to correlate tick()s with paint()s. */ protected boolean _tickPaintPending = false; + /** Whether we're currently paused. */ + protected boolean _paused; + /** Used to track the clock time at which we were paused. */ protected long _pauseTime; }