Helped the scene manager to depart from the scene. The viewer and editor
applications really need to deal directly with the scene repository. The display part of the MISO code doesn't need a scene manager, per se, because it is simply told to visualize a particular scene and scene management happens entirely externally. This is in preparation for making the MISO code work and place nicely with the Whirled code. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@246 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
//
|
||||
// $Id: SceneManager.java,v 1.7 2001/07/24 16:10:19 shaper Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
import com.samskivert.util.IntMap;
|
||||
|
||||
/**
|
||||
* The SceneManager provides a single access point for retrieving and
|
||||
* caching the various scenes that make up a game.
|
||||
*/
|
||||
public class SceneManager
|
||||
{
|
||||
/**
|
||||
* Initialize the SceneManager with the given scene repository.
|
||||
*
|
||||
* @param repo the scene repository.
|
||||
*/
|
||||
public SceneManager (SceneRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Scene object for the specified scene id.
|
||||
*
|
||||
* @param sid the scene id.
|
||||
* @return the Scene object.
|
||||
*/
|
||||
public Scene getScene (int sid)
|
||||
{
|
||||
// TBD
|
||||
return null;
|
||||
}
|
||||
|
||||
public SceneRepository getSceneRepository ()
|
||||
{
|
||||
return _repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a String array of all scene layer names ordered by
|
||||
* ascending layer id.
|
||||
*
|
||||
* @return the layer names.
|
||||
*/
|
||||
public String[] getLayerNames ()
|
||||
{
|
||||
return Scene.XLATE_LAYERS;
|
||||
}
|
||||
|
||||
/** The repository used to read and write scenes. */
|
||||
protected SceneRepository _repo;
|
||||
|
||||
/** The currently cached scenes. */
|
||||
protected IntMap _scenes = new IntMap();
|
||||
}
|
||||
@@ -1,12 +1,21 @@
|
||||
//
|
||||
// $Id: SceneRepository.java,v 1.1 2001/07/24 16:10:19 shaper Exp $
|
||||
// $Id: SceneRepository.java,v 1.2 2001/08/15 00:00:51 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The SceneRepository interface manages persistent scene storage.
|
||||
*/
|
||||
public interface SceneRepository
|
||||
{
|
||||
// TBD
|
||||
/**
|
||||
* Loads and returns the scene object with the specified id.
|
||||
*
|
||||
* @param fname the full pathname to the file.
|
||||
*
|
||||
* @return the scene object.
|
||||
*/
|
||||
public Scene loadScene (String fname) throws IOException;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
//
|
||||
// $Id: MisoContext.java,v 1.2 2001/07/21 01:51:10 shaper Exp $
|
||||
// $Id: MisoContext.java,v 1.3 2001/08/15 00:00:51 mdb Exp $
|
||||
|
||||
package com.threerings.miso.util;
|
||||
|
||||
import com.samskivert.util.Context;
|
||||
import com.threerings.miso.tile.TileManager;
|
||||
import com.threerings.miso.scene.SceneManager;
|
||||
|
||||
public interface MisoContext extends Context
|
||||
{
|
||||
@@ -14,10 +13,4 @@ public interface MisoContext extends Context
|
||||
* for the lifetime of the application.
|
||||
*/
|
||||
public TileManager getTileManager ();
|
||||
|
||||
/**
|
||||
* Return a reference to the SceneManager. This reference is
|
||||
* valid for the lifetime of the application.
|
||||
*/
|
||||
public SceneManager getSceneManager ();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: MisoUtil.java,v 1.5 2001/08/13 15:00:24 shaper Exp $
|
||||
// $Id: MisoUtil.java,v 1.6 2001/08/15 00:00:51 mdb Exp $
|
||||
|
||||
package com.threerings.miso.util;
|
||||
|
||||
@@ -33,27 +33,26 @@ public class MisoUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>SceneManager</code> object, reading the class
|
||||
* name to instantiate from the config object.
|
||||
* Create an <code>XMLFileSceneRepository</code> object, reading the
|
||||
* name of the class to instantiate from the config object.
|
||||
*
|
||||
* @param config the <code>Config</code> object.
|
||||
*
|
||||
* @return the new scene manager object or null if an error occurred.
|
||||
* @return the new scene repository object or null if an error
|
||||
* occurred.
|
||||
*/
|
||||
public static SceneManager
|
||||
createSceneManager (Config config, TileManager tilemgr)
|
||||
public static XMLFileSceneRepository createSceneRepository (
|
||||
Config config, TileManager tilemgr)
|
||||
{
|
||||
try {
|
||||
SceneRepositoryImpl scenerepo = (SceneRepositoryImpl)
|
||||
XMLFileSceneRepository scenerepo = (XMLFileSceneRepository)
|
||||
config.instantiateValue("miso.scenerepo", DEF_SCENEREPO);
|
||||
scenerepo.init(config, tilemgr);
|
||||
|
||||
SceneManager scenemgr = new SceneManager(scenerepo);
|
||||
|
||||
return scenemgr;
|
||||
return scenerepo;
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to instantiate scene manager [e=" + e + "].");
|
||||
Log.warning("Failed to instantiate scene repository " +
|
||||
"[e=" + e + "].");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -106,8 +105,8 @@ public class MisoUtil
|
||||
*
|
||||
* @return the new tileset manager object or null if an error occurred.
|
||||
*/
|
||||
protected static TileSetManager
|
||||
createTileSetManager (Config config, ImageManager imgmgr)
|
||||
protected static TileSetManager createTileSetManager (
|
||||
Config config, ImageManager imgmgr)
|
||||
{
|
||||
TileSetManagerImpl tilesetmgr = null;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user