C# Class manlyMiniGames.Map

Show file Open project: degrand1/Manly-Mini-Games Class Usage Examples

Public Properties

Property Type Description
center Vector2

Public Methods

Method Description
Draw ( SpriteBatch batch ) : void
LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void

Loading the textures

Map ( ) : System
drawOnMap ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D tex, Vector2 pos ) : void

Renders a texture onto the map using the given spritebatch and map position

screenToWorld ( Vector2 pos ) : Vector2

Returns the world position relative to the screen position given

setViewPos ( Vector2 pos ) : void

Center the screen on the given world coordinate

worldToScreen ( Vector2 pos ) : Vector2

Returns the screen position matching the given world position

Private Methods

Method Description
Grid ( int x, int y ) : UInt16

Returns the grid at the relative position with bounds checking

Method Details

Draw() public method

public Draw ( SpriteBatch batch ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch
return void

LoadContent() public method

Loading the textures
public LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager The manager handling the textures
return void

Map() public method

public Map ( ) : System
return System

drawOnMap() public method

Renders a texture onto the map using the given spritebatch and map position
public drawOnMap ( SpriteBatch batch, Microsoft.Xna.Framework.Graphics.Texture2D tex, Vector2 pos ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch Spritebatch to render the texture
tex Microsoft.Xna.Framework.Graphics.Texture2D Texture we want to render
pos Vector2
return void

screenToWorld() public method

Returns the world position relative to the screen position given
public screenToWorld ( Vector2 pos ) : Vector2
pos Vector2 The screen position
return Vector2

setViewPos() public method

Center the screen on the given world coordinate
public setViewPos ( Vector2 pos ) : void
pos Vector2 World Coordinate
return void

worldToScreen() public method

Returns the screen position matching the given world position
public worldToScreen ( Vector2 pos ) : Vector2
pos Vector2 world position
return Vector2

Property Details

center public property

public Vector2 center
return Vector2