public class SimpleMisoSceneModel extends MisoSceneModel
Additionally, it makes the assumption that the single model will be
used to display a scene on a rectangular screen (dimensions defined by
vwidth and vheight) and further optimizes the base
tile array to obviate the need to store tile data for things that fall
outside the bounds of the screen.
Streamable.Closure| Modifier and Type | Field and Description |
|---|---|
int[] |
baseTileIds
The combined tile ids (tile set id and tile id) in compressed
format.
|
short |
height
The height of this scene in tiles.
|
ObjectInfo[] |
objectInfo
Information records for the "interesting" objects in the object
layer.
|
int[] |
objectTileIds
The combined tile ids (tile set id and tile id) of the
"uninteresting" tiles in the object layer.
|
short[] |
objectXs
The x coordinate of the "uninteresting" tiles in the object
layer.
|
short[] |
objectYs
The y coordinate of the "uninteresting" tiles in the object
layer.
|
int |
vheight
The viewport height in tiles.
|
int |
vwidth
The viewport width in tiles.
|
short |
width
The width of this scene in tiles.
|
| Constructor and Description |
|---|
SimpleMisoSceneModel()
Creates a completely uninitialized model suitable for little more
than unserialization.
|
SimpleMisoSceneModel(int width,
int height,
int vwidth,
int vheight)
Creates a blank scene model with the specified dimensions.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addObject(ObjectInfo info)
Adds an object to this scene.
|
SimpleMisoSceneModel |
clone() |
int |
getBaseTileId(int col,
int row)
Returns the fully qualified tile id of the base tile at the
specified coordinates.
|
void |
getObjects(Rectangle region,
ObjectSet set)
Populates the supplied object set with info on all objects whose
origin falls in the requested region.
|
static void |
populateObjects(SimpleMisoSceneModel model,
List<ObjectInfo> ilist,
List<ObjectInfo> ulist)
Populates the interesting and uninteresting parts of a miso scene
model given lists of
ObjectInfo records for each. |
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 |
updateObject(ObjectInfo info)
Updates an object in this scene.
|
getDefaultBaseTileSet, setDefaultBaseTileSettoStringpublic short width
public short height
public int vwidth
public int vheight
public int[] baseTileIds
public int[] objectTileIds
public short[] objectXs
public short[] objectYs
public ObjectInfo[] objectInfo
public SimpleMisoSceneModel()
public SimpleMisoSceneModel(int width,
int height,
int vwidth,
int vheight)
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 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 SimpleMisoSceneModel clone()
clone in class MisoSceneModelpublic static void populateObjects(SimpleMisoSceneModel model, List<ObjectInfo> ilist, List<ObjectInfo> ulist)
ObjectInfo records for each.Copyright © 2015. All rights reserved.