Major low-level rendering rethink.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1287 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-04-23 01:18:17 +00:00
parent cc6a9d00ef
commit 0bde11ee81
5 changed files with 148 additions and 224 deletions
@@ -1,11 +1,13 @@
//
// $Id: BuilderPanel.java,v 1.5 2001/11/27 08:09:35 mdb Exp $
// $Id: BuilderPanel.java,v 1.6 2002/04/23 01:17:28 mdb Exp $
package com.threerings.cast.builder;
import javax.swing.*;
import com.samskivert.swing.*;
import com.threerings.media.FrameManager;
import com.threerings.cast.CharacterManager;
import com.threerings.cast.ComponentRepository;
@@ -19,7 +21,8 @@ public class BuilderPanel extends JPanel
/**
* Constructs the builder panel.
*/
public BuilderPanel (CharacterManager charmgr, ComponentRepository crepo)
public BuilderPanel (FrameManager framemgr, CharacterManager charmgr,
ComponentRepository crepo)
{
setLayout(new VGroupLayout());
@@ -35,7 +38,7 @@ public class BuilderPanel extends JPanel
// create the component selection and sprite display panels
JPanel sub = new JPanel(gl);
sub.add(new ComponentPanel(model));
sub.add(new SpritePanel(charmgr, model));
sub.add(new SpritePanel(framemgr, charmgr, model));
add(sub);
}
}
@@ -1,5 +1,5 @@
//
// $Id: SpritePanel.java,v 1.12 2002/03/16 03:15:04 shaper Exp $
// $Id: SpritePanel.java,v 1.13 2002/04/23 01:17:28 mdb Exp $
package com.threerings.cast.builder;
@@ -11,9 +11,8 @@ import java.awt.Rectangle;
import java.util.List;
import com.threerings.media.animation.AnimatedPanel;
import com.threerings.media.animation.AnimationManager;
import com.threerings.media.sprite.SpriteManager;
import com.threerings.media.FrameManager;
import com.threerings.media.MediaPanel;
import com.threerings.util.DirectionCodes;
@@ -27,29 +26,28 @@ import com.threerings.cast.StandardActions;
* The sprite panel displays a character sprite centered in the panel
* suitable for user perusal.
*/
public class SpritePanel extends AnimatedPanel
public class SpritePanel extends MediaPanel
implements DirectionCodes, BuilderModelListener
{
/**
* Constructs the sprite panel.
*/
public SpritePanel (CharacterManager charmgr, BuilderModel model)
public SpritePanel (FrameManager framemgr, CharacterManager charmgr,
BuilderModel model)
{
super(framemgr);
// save off references
_charmgr = charmgr;
_model = model;
// create managers
_spritemgr = new SpriteManager();
_animmgr = new AnimationManager(_spritemgr, this);
// listen to the builder model so that we can update the
// sprite when a new component is selected
_model.addListener(this);
}
// documentation inherited
protected void render (Graphics2D gfx, List invalidRects)
protected void paintMiddle (Graphics2D gfx, List invalidRects)
{
// clear the background
gfx.setColor(Color.lightGray);
@@ -122,12 +120,6 @@ public class SpritePanel extends AnimatedPanel
/** The sprite displayed by the panel. */
protected CharacterSprite _sprite;
/** The animation manager. */
protected AnimationManager _animmgr;
/** The sprite manager. */
protected SpriteManager _spritemgr;
/** The character manager. */
protected CharacterManager _charmgr;