C# Class Engine.Objects.Layer

A Sphere map layer.
Afficher le fichier Open project: Radnen/sphere-sfml Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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.
Résultat void

CloneTiles() public méthode

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

CreateNew() public méthode

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.
Résultat void

FromBinary() public static méthode

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

GetTile() public méthode

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.
Résultat short

Layer() public méthode

Constructs a new Sphere layer.
public Layer ( ) : System
Résultat System

ReplaceTiles() public méthode

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.
Résultat void

Resize() public méthode

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.
Résultat void

Save() public méthode

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

SetTile() public méthode

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.
Résultat bool

SetTiles() public méthode

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

Validate() public méthode

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.
Résultat bool