Provide the AbstractMediaManager with a reference to the panel it's

working with rather than just the RegionManager.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3347 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-02-14 03:00:58 +00:00
parent 113ca65f7a
commit 459d677a2f
3 changed files with 21 additions and 9 deletions
@@ -1,5 +1,5 @@
// //
// $Id: AbstractMediaManager.java,v 1.14 2004/11/11 23:52:43 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -41,9 +41,10 @@ public abstract class AbstractMediaManager
/** /**
* Default constructor. * Default constructor.
*/ */
public AbstractMediaManager (RegionManager remgr) public AbstractMediaManager (MediaPanel panel)
{ {
_remgr = remgr; _panel = panel;
_remgr = panel.getRegionManager();
} }
/** /**
@@ -54,6 +55,14 @@ public abstract class AbstractMediaManager
return _remgr; return _remgr;
} }
/**
* Returns the media panel with which we are coordinating.
*/
public MediaPanel getMediaPanel ()
{
return _panel;
}
/** /**
* Must be called every frame so that the media can be properly * Must be called every frame so that the media can be properly
* updated. * updated.
@@ -278,6 +287,9 @@ public abstract class AbstractMediaManager
_notify.clear(); _notify.clear();
} }
/** The media panel we're working with. */
protected MediaPanel _panel;
/** The region manager. */ /** The region manager. */
protected RegionManager _remgr; protected RegionManager _remgr;
@@ -93,8 +93,8 @@ public class MediaPanel extends JComponent
_remgr = new RegionManager(); _remgr = new RegionManager();
// create our animation and sprite managers // create our animation and sprite managers
_animmgr = new AnimationManager(_remgr); _animmgr = new AnimationManager(this);
_spritemgr = new SpriteManager(_remgr); _spritemgr = new SpriteManager(this);
// participate in the frame when we're visible // participate in the frame when we're visible
addAncestorListener(new AncestorAdapter() { addAncestorListener(new AncestorAdapter() {
@@ -1,5 +1,5 @@
// //
// $Id: AnimationManager.java,v 1.19 2004/08/27 02:12:38 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -22,7 +22,7 @@
package com.threerings.media.animation; package com.threerings.media.animation;
import com.threerings.media.AbstractMediaManager; import com.threerings.media.AbstractMediaManager;
import com.threerings.media.RegionManager; import com.threerings.media.MediaPanel;
/** /**
* Manages a collection of animations, ticking them when the animation * Manages a collection of animations, ticking them when the animation
@@ -35,9 +35,9 @@ public class AnimationManager extends AbstractMediaManager
* Construct and initialize the animation manager which readies itself * Construct and initialize the animation manager which readies itself
* to manage animations. * to manage animations.
*/ */
public AnimationManager (RegionManager remgr) public AnimationManager (MediaPanel panel)
{ {
super(remgr); super(panel);
} }
/** /**