public class SparseMisoSceneModel extends MisoSceneModel
| Modifier and Type | Class and Description |
|---|---|
static interface |
SparseMisoSceneModel.ObjectVisitor
An interface that allows external entities to "visit" and inspect
every object in this scene.
|
static class |
SparseMisoSceneModel.Section
Contains information on a section of this scene.
|
Streamable.Closure| Modifier and Type | Field and Description |
|---|---|
int |
defTileSet
The tileset to use when we have no tile data.
|
short |
sheight
The dimensions of a section of our scene.
|
short |
swidth
The dimensions of a section of our scene.
|
| Constructor and Description |
|---|
SparseMisoSceneModel()
Creates a blank model suitable for unserialization.
|
SparseMisoSceneModel(int swidth,
int sheight)
Creates a scene model with the specified bounds.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addObject(ObjectInfo info)
Adds an object to this scene.
|
SparseMisoSceneModel |
clone() |
void |
getAllObjects(ArrayList<ObjectInfo> list)
Adds all
ObjectInfo records in this scene to the supplied list. |
int |
getBaseTileId(int col,
int row)
Returns the fully qualified tile id of the base tile at the
specified coordinates.
|
int |
getDefaultBaseTileSet()
Scene models can return a default tileset to be used when no base
tile data exists for a particular tile.
|
void |
getInterestingObjects(ArrayList<ObjectInfo> list)
Adds all interesting
ObjectInfo records in this scene to
the supplied list. |
void |
getObjects(Rectangle region,
ObjectSet set)
Populates the supplied object set with info on all objects whose
origin falls in the requested region.
|
Iterator<SparseMisoSceneModel.Section> |
getSections()
Don't call this method! This is only public so that the scene
writer can generate XML from the raw scene data.
|
boolean |
removeObject(ObjectInfo info)
Removes the specified object from the scene.
|
boolean |
setBaseTile(int fqBaseTileId,
int col,
int row)
Updates the tile at the specified location in the base layer.
|
void |
setDefaultBaseTileSet(int tileSetId)
Updates the default base tileset id for this scene.
|
void |
setSection(SparseMisoSceneModel.Section section)
Don't call this method! This is only public so that the scene
parser can construct a scene from raw data.
|
void |
updateObject(ObjectInfo info)
Updates an object in this scene.
|
void |
visitObjects(SparseMisoSceneModel.ObjectVisitor visitor)
Informs the supplied visitor of each object in this scene.
|
void |
visitObjects(SparseMisoSceneModel.ObjectVisitor visitor,
boolean interestingOnly)
Informs the supplied visitor of each object in this scene.
|
toStringpublic short swidth
public short sheight
public int defTileSet
public SparseMisoSceneModel(int swidth,
int sheight)
swidth - the width of a single section (in tiles).sheight - the height of a single section (in tiles).public SparseMisoSceneModel()
public void getInterestingObjects(ArrayList<ObjectInfo> list)
ObjectInfo records in this scene to
the supplied list.public void getAllObjects(ArrayList<ObjectInfo> list)
ObjectInfo records in this scene to the supplied list.public void visitObjects(SparseMisoSceneModel.ObjectVisitor visitor)
public void visitObjects(SparseMisoSceneModel.ObjectVisitor visitor, boolean interestingOnly)
interestingOnly - if true, only the interesting objects will
be visited.public int getBaseTileId(int col,
int row)
MisoSceneModel-1 will be returned if there is
no tile at the specified coordinate.getBaseTileId in class MisoSceneModelpublic boolean setBaseTile(int fqBaseTileId,
int col,
int row)
MisoSceneModelNote that if there are fringe tiles associated with this scene, calling this method may result in the surrounding fringe tiles being cleared and subsequently recalculated. This should not be called on a displaying scene unless you know what you are doing.
setBaseTile in class MisoSceneModelfqBaseTileId - the fully-qualified tile id (@see
TileUtil#getFQTileId}) of the tile to set.col - the x-coordinate of the tile to set.row - the y-coordinate of the tile to set.public void setDefaultBaseTileSet(int tileSetId)
MisoSceneModelsetDefaultBaseTileSet in class MisoSceneModelpublic int getDefaultBaseTileSet()
MisoSceneModelgetDefaultBaseTileSet in class MisoSceneModelpublic void getObjects(Rectangle region, ObjectSet set)
MisoSceneModelgetObjects in class MisoSceneModelpublic boolean addObject(ObjectInfo info)
MisoSceneModeladdObject in class MisoSceneModelpublic void updateObject(ObjectInfo info)
MisoSceneModelupdateObject in class MisoSceneModelpublic boolean removeObject(ObjectInfo info)
MisoSceneModelremoveObject in class MisoSceneModelpublic void setSection(SparseMisoSceneModel.Section section)
public Iterator<SparseMisoSceneModel.Section> getSections()
public SparseMisoSceneModel clone()
clone in class MisoSceneModelCopyright © 2015. All rights reserved.