C# Class PlatformerPOC.Renderer

Centralized rendering and viewport implementation.
显示文件 Open project: bramdemoor/MonoGame-PlatformerPOC Class Usage Examples

Public Properties

Property Type Description
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch

Private Properties

Property Type Description
DrawAll void
DrawBorder void
DrawDebug void
DrawHud void
GetRelativeCoords Microsoft.Xna.Framework.Rectangle
GetRelativeCoords Vector2
GetSpriteEffects SpriteEffects
IsObjectInArea bool
IsObjectInView bool

Public Methods

Method Description
Draw ( ) : void

Single public method

GetWorldCoords ( Vector2 viewCoords ) : Vector2

Converts view coordinates into world coordinates

LoadContent ( ) : void
Renderer ( PlatformGame game ) : System
UpdateCameraPosition ( float x, GameTime gameTime ) : void

Scroll the view to a specified horizontal coordinate. Optionally, apply camera shake effect FYI V-scrolling is blocked

Private Methods

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

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

DrawDebug ( ) : void
DrawHud ( ) : void
GetRelativeCoords ( Rectangle realWorldRectangle ) : Rectangle

Converts world rectangle into view rectangle

GetRelativeCoords ( Vector2 realWorldCoords ) : Vector2

Converts world coordinates into view coordinates

GetSpriteEffects ( HorizontalDirection horizontalDirection ) : SpriteEffects
IsObjectInArea ( Rectangle objectRectangle ) : bool
IsObjectInView ( BaseGameObject obj ) : bool

Method Details

Draw() public method

Single public method
public Draw ( ) : void
return void

GetWorldCoords() public method

Converts view coordinates into world coordinates
public GetWorldCoords ( Vector2 viewCoords ) : Vector2
viewCoords Vector2
return Vector2

LoadContent() public method

public LoadContent ( ) : void
return void

Renderer() public method

public Renderer ( PlatformGame game ) : System
game PlatformGame
return System

UpdateCameraPosition() public method

Scroll the view to a specified horizontal coordinate. Optionally, apply camera shake effect FYI V-scrolling is blocked
public UpdateCameraPosition ( float x, GameTime gameTime ) : void
x float
gameTime Microsoft.Xna.Framework.GameTime
return void

Property Details

spriteBatch public_oe property

public SpriteBatch,Microsoft.Xna.Framework.Graphics spriteBatch
return Microsoft.Xna.Framework.Graphics.SpriteBatch