C# Class Azmyth.XNA.TerrainManager

Inheritance: Microsoft.Xna.Framework.GameComponent
Datei anzeigen Open project: GalacticSoft/Azmyth Class Usage Examples

Private Properties

Property Type Description
DrawBorder void

Public Methods

Method Description
CenterTile ( float tileX, float tileY ) : void

Will center terrain at specified coordinates. (in tiles)

Draw ( GameTime gameTime ) : void

Draws the loaded chunks visible in the viewport

GetChunkCount ( ) : int
GetNodeCount ( ) : int
Initialize ( ) : void

Allows the game to perform any initialization it needs to before starting to run. This is where it can query for any required services and load any non-graphic related content. Calling base.Initialize will enumerate through any components and initialize them as well.

LoadChunk ( float chunkX, float chunkY ) : void

Load a chunk at specified x and y position (in chunks)

LoadContent ( ) : void

Loads terrain tiles

ScreenToTile ( Rectangle screenRect ) : System.Drawing.RectangleF

Converts screen rectangle into tiles

ScreenToTileF ( System screenRect ) : System.Drawing.RectangleF

Converts screen rectangle into tiles

TerrainManager ( AzmythGame game ) : System
TileToScreen ( System tileRect ) : Rectangle

Converts tile rectangle into screen position.

TileToScreenF ( System tileRect ) : System.Drawing.RectangleF

Converts tile rectangle into screen position.

Update ( GameTime gameTime ) : void

Updates chunk states.

UpdateChunks ( Vector2 position ) : void

Private Methods

Method Description
DrawBorder ( Rectangle rectangleToDraw, int thicknessOfBorder, Color borderColor ) : void

Will draw a border (hollow rectangle) of the given 'thicknessOfBorder' (in pixels) of the specified color. By Sean Colombo, from http://bluelinegamestudios.com/blog

Method Details

CenterTile() public method

Will center terrain at specified coordinates. (in tiles)
public CenterTile ( float tileX, float tileY ) : void
tileX float
tileY float
return void

Draw() public method

Draws the loaded chunks visible in the viewport
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

GetChunkCount() public method

public GetChunkCount ( ) : int
return int

GetNodeCount() public method

public GetNodeCount ( ) : int
return int

Initialize() public method

Allows the game to perform any initialization it needs to before starting to run. This is where it can query for any required services and load any non-graphic related content. Calling base.Initialize will enumerate through any components and initialize them as well.
public Initialize ( ) : void
return void

LoadChunk() public method

Load a chunk at specified x and y position (in chunks)
public LoadChunk ( float chunkX, float chunkY ) : void
chunkX float
chunkY float
return void

LoadContent() public method

Loads terrain tiles
public LoadContent ( ) : void
return void

ScreenToTile() public method

Converts screen rectangle into tiles
public ScreenToTile ( Rectangle screenRect ) : System.Drawing.RectangleF
screenRect Microsoft.Xna.Framework.Rectangle
return System.Drawing.RectangleF

ScreenToTileF() public method

Converts screen rectangle into tiles
public ScreenToTileF ( System screenRect ) : System.Drawing.RectangleF
screenRect System
return System.Drawing.RectangleF

TerrainManager() public method

public TerrainManager ( AzmythGame game ) : System
game AzmythGame
return System

TileToScreen() public method

Converts tile rectangle into screen position.
public TileToScreen ( System tileRect ) : Rectangle
tileRect System
return Microsoft.Xna.Framework.Rectangle

TileToScreenF() public method

Converts tile rectangle into screen position.
public TileToScreenF ( System tileRect ) : System.Drawing.RectangleF
tileRect System
return System.Drawing.RectangleF

Update() public method

Updates chunk states.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

UpdateChunks() public method

public UpdateChunks ( Vector2 position ) : void
position Vector2
return void