C# Class Engine.Objects.Layer

A Sphere map layer.
Mostra file Open project: Radnen/sphere-sfml Class Usage Examples

Public Methods

Method Description
AdjustTiles ( short startindex, short delta ) : void

Adjusts the tile indicies for when tiles were removed or added.

CloneTiles ( ) : short[]

Creates a hard copy of the data.

CreateNew ( short width, short height ) : void

Creates a blank layer.

FromBinary ( BinaryReader reader ) : Layer

Creates a proper Sphere from a data stream.

GetTile ( int x, int y ) : short

Gets tile index at the (x, y) position.

Layer ( ) : System

Constructs a new Sphere layer.

ReplaceTiles ( short from, short to ) : void

Replaces all the tile indices on this layer from 'from' to 'to'.

Resize ( short width, short height ) : void

Resizes the field to the new size.

Save ( BinaryWriter writer ) : void

Writes data to the binary writer.

SetTile ( int x, int y, short index ) : bool

Sets a tile, if applicable.

SetTiles ( short tiles ) : void

Pump in a 2D array to replace current tiles with.

Validate ( int max ) : bool

Checks to see if the layer has correct tile indicies. Will set afflicted tiles to 0, if check fails.

Method Details

AdjustTiles() public method

Adjusts the tile indicies for when tiles were removed or added.
public AdjustTiles ( short startindex, short delta ) : void
startindex short Index to start at.
delta short How much of a shift to make.
return void

CloneTiles() public method

Creates a hard copy of the data.
public CloneTiles ( ) : short[]
return short[]

CreateNew() public method

Creates a blank layer.
public CreateNew ( short width, short height ) : void
width short Width in tiles to use.
height short Height in tiles to use.
return void

FromBinary() public static method

Creates a proper Sphere from a data stream.
public static FromBinary ( BinaryReader reader ) : Layer
reader System.IO.BinaryReader BinaryReader to use.
return Layer

GetTile() public method

Gets tile index at the (x, y) position.
public GetTile ( int x, int y ) : short
x int X-coord of tile.
y int Y-coord of tile.
return short

Layer() public method

Constructs a new Sphere layer.
public Layer ( ) : System
return System

ReplaceTiles() public method

Replaces all the tile indices on this layer from 'from' to 'to'.
public ReplaceTiles ( short from, short to ) : void
from short The old index to replace.
to short The new index to replace with.
return void

Resize() public method

Resizes the field to the new size.
public Resize ( short width, short height ) : void
width short New width of the field.
height short New height of the field.
return void

Save() public method

Writes data to the binary writer.
public Save ( BinaryWriter writer ) : void
writer System.IO.BinaryWriter BinaryWriter to use.
return void

SetTile() public method

Sets a tile, if applicable.
public SetTile ( int x, int y, short index ) : bool
x int X-coord to use.
y int Y-coord to use.
index short Index to set to.
return bool

SetTiles() public method

Pump in a 2D array to replace current tiles with.
public SetTiles ( short tiles ) : void
tiles short New array of tile indicies to use.
return void

Validate() public method

Checks to see if the layer has correct tile indicies. Will set afflicted tiles to 0, if check fails.
public Validate ( int max ) : bool
max int The maximum tile index expected.
return bool