public class MapTilePersisterModel extends FeatureModel implements MapTilePersister
Constructor and Description |
---|
MapTilePersisterModel(Services services)
Create the persister.
|
Modifier and Type | Method and Description |
---|---|
void |
load(FileReading input)
Load a map from a specified file as binary data.
|
protected Tile |
loadTile(FileReading file,
int i)
Load tile.
|
void |
save(FileWriting output)
Save map to specified file as binary data.
|
protected void |
saveTile(FileWriting file,
Tile tile)
Save tile.
|
checkListener, getFeature, getFeatures, getFeaturesType, hasFeature, prepare
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkListener, prepare
getFeature, getFeatures, getFeaturesType, hasFeature
public MapTilePersisterModel(Services services)
services
- The services reference.protected void saveTile(FileWriting file, Tile tile) throws IOException
(integer) sheet number (integer) index number inside sheet (integer) tile location x % MapTile.BLOC_SIZE (integer tile location y
file
- The file writer reference.tile
- The tile to save.IOException
- If error on writing.protected Tile loadTile(FileReading file, int i) throws IOException
(integer) sheet number (integer) index number inside sheet (integer) tile location x (integer tile location y
file
- The file reader reference.i
- The last loaded tile number.IOException
- If error on reading.public void save(FileWriting output) throws IOException
(String)
sheets configuration file(short)
width in tiles(short)
height in tiles(byte)
tile width (use of byte because tile width < 255)(byte)
tile height (use of byte because tile height < 255)(short)
number of horizontal blocs (widthInTile / ) for each blocs tile(short)
number of tiles in this bloc for each tile in this bloc call tile.save(file)
save
in interface Persistable
output
- The output level file.IOException
- If error on writing.public void load(FileReading input) throws IOException
Data are loaded this way (see save(FileWriting)
order):
(String)
sheets file configuration(short)
width in tiles(short)
height in tiles(byte)
tile width(byte)
tile height(short)
number of horizontal blocs (widthInTile / ) for each blocs tile(short)
number of tiles in this bloc for each tile in this bloc create blank tile call load(file) call setTile(...) to update map with this new tile
load
in interface Persistable
input
- The input level file.IOException
- If error on reading.Copyright © 2017 Byron 3D Games Studio. All rights reserved.