Added row-based tile width, image offset, and image row/column gap
distance parameters to tile sets. Removed constant tile width/height references except, for now, for isometric tile rendering which still requires tiles that are 32x16. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@130 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneViewPanel.java,v 1.1 2001/07/25 17:38:15 shaper Exp $
|
||||
// $Id: SceneViewPanel.java,v 1.2 2001/07/28 01:31:51 shaper Exp $
|
||||
|
||||
package com.threerings.miso.viewer;
|
||||
|
||||
@@ -27,19 +27,33 @@ public class SceneViewPanel extends JPanel
|
||||
public SceneViewPanel (ViewerContext ctx)
|
||||
{
|
||||
_ctx = ctx;
|
||||
_view = new IsoSceneView(_ctx.getTileManager());
|
||||
|
||||
// construct the view object
|
||||
_view = new IsoSceneView(_ctx.getTileManager());
|
||||
|
||||
// listen to the desired events
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
|
||||
// load up the initial scene
|
||||
prepareStartingScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and set up the starting scene for display.
|
||||
*/
|
||||
protected void prepareStartingScene ()
|
||||
{
|
||||
// get the scene repository
|
||||
XMLFileSceneRepository repo = (XMLFileSceneRepository)
|
||||
_ctx.getSceneManager().getSceneRepository();
|
||||
|
||||
// load the starting scene
|
||||
// get the starting scene filename
|
||||
Config config = _ctx.getConfig();
|
||||
String fname = config.getValue(CONF_SCENE, (String)DEF_SCENE);
|
||||
|
||||
try {
|
||||
// load and set up the scene
|
||||
_view.setScene(repo.loadScene(fname));
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Exception loading scene [fname=" + fname +
|
||||
@@ -62,12 +76,14 @@ public class SceneViewPanel extends JPanel
|
||||
{
|
||||
super.paint(g);
|
||||
_view.paint(g);
|
||||
Log.info("paint()");
|
||||
}
|
||||
|
||||
/** MouseListener interface methods */
|
||||
|
||||
public void mouseClicked (MouseEvent e)
|
||||
{
|
||||
Log.info("mouseClicked [x=" + e.getX() + ", y=" + e.getY() + "].");
|
||||
}
|
||||
|
||||
public void mouseEntered (MouseEvent e) { }
|
||||
@@ -76,6 +92,7 @@ public class SceneViewPanel extends JPanel
|
||||
|
||||
public void mousePressed (MouseEvent e)
|
||||
{
|
||||
Log.info("mousePressed [x=" + e.getX() + ", y=" + e.getY() + "].");
|
||||
}
|
||||
|
||||
public void mouseReleased (MouseEvent e) { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ViewerApp.java,v 1.1 2001/07/25 17:38:15 shaper Exp $
|
||||
// $Id: ViewerApp.java,v 1.2 2001/07/28 01:31:51 shaper Exp $
|
||||
|
||||
package com.threerings.miso.viewer;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ViewerApp
|
||||
// create and size the main application frame
|
||||
_frame = new ViewerFrame();
|
||||
_frame.setSize(WIDTH, HEIGHT);
|
||||
// SwingUtil.centerFrame(_frame);
|
||||
SwingUtil.centerWindow(_frame);
|
||||
|
||||
// create the handles on our various services
|
||||
_config = createConfig();
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
//
|
||||
// $Id: ViewerFrame.java,v 1.1 2001/07/25 17:38:15 shaper Exp $
|
||||
// $Id: ViewerFrame.java,v 1.2 2001/07/28 01:31:51 shaper Exp $
|
||||
|
||||
package com.threerings.miso.viewer;
|
||||
|
||||
import com.samskivert.swing.*;
|
||||
import com.samskivert.swing.util.MenuUtil;
|
||||
import com.threerings.miso.Log;
|
||||
import com.threerings.miso.viewer.util.ViewerContext;
|
||||
import com.threerings.miso.scene.Scene;
|
||||
import com.threerings.miso.sprite.AnimationManager;
|
||||
import com.threerings.miso.sprite.SpriteManager;
|
||||
import com.threerings.miso.viewer.util.ViewerContext;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -19,7 +19,7 @@ import javax.swing.*;
|
||||
* contains the application menu bar and panels and responds to menu
|
||||
* events.
|
||||
*/
|
||||
class ViewerFrame extends JFrame implements ActionListener
|
||||
class ViewerFrame extends JFrame
|
||||
{
|
||||
public ViewerFrame ()
|
||||
{
|
||||
@@ -33,58 +33,20 @@ class ViewerFrame extends JFrame implements ActionListener
|
||||
{
|
||||
_ctx = ctx;
|
||||
|
||||
// set up the menu bar
|
||||
createMenuBar();
|
||||
|
||||
// create a top-level panel to manage everything
|
||||
JPanel top = new JPanel();
|
||||
GroupLayout gl = new HGroupLayout(GroupLayout.STRETCH);
|
||||
gl.setOffAxisPolicy(GroupLayout.STRETCH);
|
||||
top.setLayout(gl);
|
||||
|
||||
// set up the scene view panel with a default scene
|
||||
SceneViewPanel svpanel = new SceneViewPanel(_ctx);
|
||||
// setScene(new Scene(_tilemgr, Scene.SID_INVALID));
|
||||
top.add(svpanel);
|
||||
|
||||
// now add our top-level panel
|
||||
getContentPane().add(top, BorderLayout.CENTER);
|
||||
// create the animation manager for the panel
|
||||
SpriteManager spritemgr = new SpriteManager();
|
||||
|
||||
AnimationManager animmgr = new AnimationManager(spritemgr, svpanel);
|
||||
|
||||
// add the scene view panel
|
||||
getContentPane().add(svpanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the menu bar and menu items and add them to the frame.
|
||||
*/
|
||||
public void createMenuBar ()
|
||||
{
|
||||
KeyStroke accel = null;
|
||||
|
||||
// create the "File" menu
|
||||
JMenu menuFile = new JMenu("File");
|
||||
accel = KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK);
|
||||
MenuUtil.addMenuItem(this, menuFile, "Quit", KeyEvent.VK_Q, accel);
|
||||
|
||||
// create the menu bar
|
||||
JMenuBar bar = new JMenuBar();
|
||||
bar.add(menuFile);
|
||||
|
||||
// add the menu bar to the frame
|
||||
setJMenuBar(bar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle menu item selections.
|
||||
*/
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
|
||||
if (cmd.equals("Quit")) {
|
||||
System.exit(0);
|
||||
|
||||
} else {
|
||||
Log.warning("Unknown action command [cmd=" + cmd + "].");
|
||||
}
|
||||
}
|
||||
/** The panel displaying the scene. */
|
||||
SceneViewPanel _svpanel;
|
||||
|
||||
/** The context object. */
|
||||
protected ViewerContext _ctx;
|
||||
|
||||
Reference in New Issue
Block a user