Created base SceneViewPanel that the editor and viewer apps extend.
Added fringe layer to scenes. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@176 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AnimationManager.java,v 1.5 2001/08/02 23:12:19 shaper Exp $
|
||||
// $Id: AnimationManager.java,v 1.6 2001/08/04 01:41:02 shaper Exp $
|
||||
|
||||
package com.threerings.miso.sprite;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class AnimationManager implements Interval, PerformanceObserver
|
||||
_view.invalidateRects(rects);
|
||||
|
||||
// update frame-rate information
|
||||
PerformanceMonitor.tick(AnimationManager.this, "refresh");
|
||||
//PerformanceMonitor.tick(AnimationManager.this, "refresh");
|
||||
|
||||
// refresh the display
|
||||
_target.paintImmediately(_target.getBounds());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.16 2001/08/02 18:58:59 shaper Exp $
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.17 2001/08/04 01:41:02 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -22,10 +22,13 @@ public class Scene
|
||||
public static final int LAYER_BASE = 0;
|
||||
|
||||
/** The object layer id. */
|
||||
public static final int LAYER_OBJECT = 1;
|
||||
public static final int LAYER_FRINGE = 1;
|
||||
|
||||
/** The object layer id. */
|
||||
public static final int LAYER_OBJECT = 2;
|
||||
|
||||
/** The total number of layers. */
|
||||
public static final int NUM_LAYERS = 2;
|
||||
public static final int NUM_LAYERS = 3;
|
||||
|
||||
/** The latest scene file format version. */
|
||||
public static final short VERSION = 1;
|
||||
@@ -37,7 +40,7 @@ public class Scene
|
||||
public static final int TILE_HEIGHT = 22;
|
||||
|
||||
/** String translations of each tile layer name. */
|
||||
public static final String[] XLATE_LAYERS = { "Base", "Object" };
|
||||
public static final String[] XLATE_LAYERS = { "Base", "Fringe", "Object" };
|
||||
|
||||
/** Scene id to denote an unset or otherwise invalid scene id. */
|
||||
public static final short SID_INVALID = -1;
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// $Id: SceneViewPanel.java,v 1.1 2001/08/04 01:41:02 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.threerings.miso.sprite.SpriteManager;
|
||||
import com.threerings.miso.tile.TileManager;
|
||||
|
||||
/**
|
||||
* The <code>SceneViewPanel</code> class is responsible for managing a
|
||||
* <code>SceneView</code>, rendering it to the screen, and handling
|
||||
* view-related UI events.
|
||||
*/
|
||||
public class SceneViewPanel extends JPanel
|
||||
{
|
||||
/**
|
||||
* Construct the panel and initialize it with a context.
|
||||
*/
|
||||
public SceneViewPanel (TileManager tilemgr, SpriteManager spritemgr)
|
||||
{
|
||||
// create the data model for the scene view
|
||||
_smodel = new IsoSceneModel();
|
||||
_smodel.setTileDimensions(TWIDTH, THEIGHT);
|
||||
_smodel.setBounds((HTILES * TWIDTH), (VTILES * THEIGHT));
|
||||
_smodel.setOrigin(_smodel.bounds.width / 2, VOFFSET);
|
||||
|
||||
// create the scene view
|
||||
_view = new IsoSceneView(tilemgr, spritemgr, _smodel);
|
||||
|
||||
// set our attributes for optimal display performance
|
||||
setDoubleBuffered(false);
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the scene managed by the panel.
|
||||
*/
|
||||
public void setScene (Scene scene)
|
||||
{
|
||||
_view.setScene(scene);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the panel and the scene view to the given graphics object.
|
||||
*/
|
||||
public void paintComponent (Graphics g)
|
||||
{
|
||||
super.paintComponent(g);
|
||||
_view.paint(g);
|
||||
}
|
||||
|
||||
/** Tile width in pixels. */
|
||||
protected static final int TWIDTH = 64;
|
||||
|
||||
/** Tile height in pixels. */
|
||||
protected static final int THEIGHT = 48;
|
||||
|
||||
/** Number of horizontal tiles in the scene. */
|
||||
protected static final int HTILES = 10;
|
||||
|
||||
/** Number of vertical tiles in the scene. */
|
||||
protected static final int VTILES = 12;
|
||||
|
||||
/** Origin vertical offset in pixels. */
|
||||
protected static final int VOFFSET = -(5 * THEIGHT);
|
||||
|
||||
/** The scene data model. */
|
||||
protected IsoSceneModel _smodel;
|
||||
|
||||
/** The scene view we're managing. */
|
||||
protected SceneView _view;
|
||||
}
|
||||
Reference in New Issue
Block a user