Automatically create a SpriteManager unless otherwise instructed; added
methods for starting and stopping the animation manager associated with an animated panel. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@995 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: AnimatedPanel.java,v 1.4 2002/01/23 17:10:41 shaper Exp $
|
// $Id: AnimatedPanel.java,v 1.5 2002/02/13 18:48:56 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.animation;
|
package com.threerings.media.animation;
|
||||||
|
|
||||||
@@ -16,15 +16,20 @@ import java.awt.image.BufferStrategy;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.threerings.media.Log;
|
import com.threerings.media.Log;
|
||||||
|
import com.threerings.media.sprite.SpriteManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The animated panel provides a useful extensible implementation of a
|
* The animated panel provides a useful extensible implementation of a
|
||||||
* {@link Canvas} that implements the {@link AnimatedView} interface. It
|
* {@link Canvas} that implements the {@link AnimatedView} interface. It
|
||||||
* takes care of automatically creating an animation manager to manage the
|
* takes care of automatically creating an animation manager and a sprite
|
||||||
* animations that take place within this panel. Derived classes should
|
* manager to manage the animations that take place within this panel. If
|
||||||
* provide said animation manager with a reference to the sprite manager
|
* a sprite manager is not needed, {@link #needsSpriteManager} can be
|
||||||
* in use by the application, if needed (via {@link
|
* overridden to prevent it from being created.
|
||||||
* AnimationManager#setSpriteManager}).
|
*
|
||||||
|
* <p> Users of the animated panel must be sure to call {@link #stop} when
|
||||||
|
* their panel is no longer being displayed and {@link #start} to start it
|
||||||
|
* back up again when it is once again being displayed. These methods
|
||||||
|
* deactivate and reactivate the underlying animation manager.
|
||||||
*
|
*
|
||||||
* <p> Sub-classes should override {@link #render} to draw their
|
* <p> Sub-classes should override {@link #render} to draw their
|
||||||
* panel-specific contents, and may choose to override {@link
|
* panel-specific contents, and may choose to override {@link
|
||||||
@@ -43,6 +48,37 @@ public class AnimatedPanel extends Canvas implements AnimatedView
|
|||||||
|
|
||||||
// create our animation manager
|
// create our animation manager
|
||||||
_animmgr = new AnimationManager(this);
|
_animmgr = new AnimationManager(this);
|
||||||
|
|
||||||
|
// create a sprite manager if we haven't been requested not to
|
||||||
|
if (needsSpriteManager()) {
|
||||||
|
_animmgr.setSpriteManager(new SpriteManager());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Derived classes can override this method to prevent the automatic
|
||||||
|
* creation of a sprite manager to work with the animation manager
|
||||||
|
* that is managing this panel.
|
||||||
|
*/
|
||||||
|
protected boolean needsSpriteManager ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts up the animation manager associated with this panel.
|
||||||
|
*/
|
||||||
|
public void start ()
|
||||||
|
{
|
||||||
|
_animmgr.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shuts down the animation manager associated with this panel.
|
||||||
|
*/
|
||||||
|
public void stop ()
|
||||||
|
{
|
||||||
|
_animmgr.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
|
|||||||
Reference in New Issue
Block a user