C# Class Project290.Rendering.Drawer

This static public class is used for all rendering in the game. It can be called from anywhere, but do not attempt to use it until the Initiallize() method has been called (this only needs to happen once ever).
Mostrar archivo Open project: scastle/Solitude

Public Methods

Method Description
Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture2D, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth ) : void

Draws the specified texture2D, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture2D, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth ) : void

Draws the specified texture2D, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture2D, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void

Draws the specified texture2D, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.

DrawControllerSymbol ( Buttons button, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth ) : void

Draws the specified controller symbol, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.

DrawLine ( Vector2 pointA, Vector2 pointB, float width, float layerDepth, Color color ) : void

Draws a black line from point A to point B.

DrawOutlinedString ( SpriteFont font, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth ) : void

Draws the specified string in the specified font, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls. This creates a black outline around the string.

DrawRectangle ( Rectangle toDraw, float width, float layerDepth, Color color ) : void

Draws the rectangle.

DrawString ( SpriteFont font, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects spriteEffects, float layerDepth ) : void

Draws the specified string in the specified font, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.

DrawString ( SpriteFont font, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth ) : void

Draws the specified string in the specified font, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.

FormatNumber ( uint value ) : string

Formats the number. For example, 12345 returns "12,345".

GetControllerSymbolMap ( char input ) : char

Gets the controller symbol mapping.

GetRatio ( ) : float

This returns the ratio of the screen height to 1080, in the event that the TV is not at a 1080i or 1080p resolution. All scales and positions should be multiplied by this in order to correctly adjust to any screen resolution, while always assuming that the screen is 1920 * 1080.

Initiallize ( ) : void

Initiallizes the static variables used by this static public class..

Private Methods

Method Description
GetLayerDepthScale ( float layerDepth ) : float

Gets the layer depth scale (so screens will be drawn on top of each other without having to worry about layer depths).

Method Details

Draw() public static method

Draws the specified texture2D, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.
public static Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture2D, Rectangle destinationRectangle, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth ) : void
texture2D Microsoft.Xna.Framework.Graphics.Texture2D The texture2 D.
destinationRectangle Microsoft.Xna.Framework.Rectangle The destination rectangle.
sourceRectangle Microsoft.Xna.Framework.Rectangle The source rectangle.
color Color The color.
rotation float The rotation.
origin Vector2 The origin.
effects SpriteEffects The effects.
layerDepth float The layer depth.
return void

Draw() public static method

Draws the specified texture2D, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.
public static Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture2D, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth ) : void
texture2D Microsoft.Xna.Framework.Graphics.Texture2D The texture2D.
position Vector2 The position.
sourceRectangle Microsoft.Xna.Framework.Rectangle The source rectangle.
color Color The color.
rotation float The rotation.
origin Vector2 The origin.
scale Vector2 The scale.
effects SpriteEffects The effects.
layerDepth float The layer depth.
return void

Draw() public static method

Draws the specified texture2D, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.
public static Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture2D, Vector2 position, Rectangle sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void
texture2D Microsoft.Xna.Framework.Graphics.Texture2D The texture2 D.
position Vector2 The position.
sourceRectangle Microsoft.Xna.Framework.Rectangle The source rectangle.
color Color The color.
rotation float The rotation.
origin Vector2 The origin.
scale float The scale.
effects SpriteEffects The effects.
layerDepth float The layer depth.
return void

DrawControllerSymbol() public static method

Draws the specified controller symbol, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.
public static DrawControllerSymbol ( Buttons button, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth ) : void
button Buttons The button to draw.
position Vector2 The position.
color Color The color of the string.
rotation float The rotation.
origin Vector2 The origin.
scale float The scale.
spriteEffects SpriteEffects The sprite effects.
layerDepth float The layer depth.
return void

DrawLine() public static method

Draws a black line from point A to point B.
public static DrawLine ( Vector2 pointA, Vector2 pointB, float width, float layerDepth, Color color ) : void
pointA Vector2 The point A.
pointB Vector2 The point B.
width float The width.
layerDepth float The layer depth.
color Color The color.
return void

DrawOutlinedString() public static method

Draws the specified string in the specified font, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls. This creates a black outline around the string.
public static DrawOutlinedString ( SpriteFont font, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth ) : void
font Microsoft.Xna.Framework.Graphics.SpriteFont The font.
text string The text to write.
position Vector2 The position.
color Color The color of the string.
rotation float The rotation.
origin Vector2 The origin.
scale float The scale.
spriteEffects SpriteEffects The sprite effects.
layerDepth float The layer depth.
return void

DrawRectangle() public static method

Draws the rectangle.
public static DrawRectangle ( Rectangle toDraw, float width, float layerDepth, Color color ) : void
toDraw Microsoft.Xna.Framework.Rectangle The rectangle to draw.
width float The width.
layerDepth float The layer depth.
color Color The color.
return void

DrawString() public static method

Draws the specified string in the specified font, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.
public static DrawString ( SpriteFont font, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects spriteEffects, float layerDepth ) : void
font Microsoft.Xna.Framework.Graphics.SpriteFont The font.
text string The text to write.
position Vector2 The position.
color Color The color of the string.
rotation float The rotation.
origin Vector2 The origin.
scale Vector2 The scale.
spriteEffects SpriteEffects The sprite effects.
layerDepth float The layer depth.
return void

DrawString() public static method

Draws the specified string in the specified font, assuming that it was drawn assuming the screen is exactly 1920 * 1080. Be sure to call spriteBatch.Begin() before this and spriteBatch.End() at the end of the series of Drawing calls.
public static DrawString ( SpriteFont font, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth ) : void
font Microsoft.Xna.Framework.Graphics.SpriteFont The font.
text string The text to write.
position Vector2 The position.
color Color The color of the string.
rotation float The rotation.
origin Vector2 The origin.
scale float The scale.
spriteEffects SpriteEffects The sprite effects.
layerDepth float The layer depth.
return void

FormatNumber() public static method

Formats the number. For example, 12345 returns "12,345".
public static FormatNumber ( uint value ) : string
value uint The value.
return string

GetControllerSymbolMap() public static method

Gets the controller symbol mapping.
public static GetControllerSymbolMap ( char input ) : char
input char The input.
return char

GetRatio() public static method

This returns the ratio of the screen height to 1080, in the event that the TV is not at a 1080i or 1080p resolution. All scales and positions should be multiplied by this in order to correctly adjust to any screen resolution, while always assuming that the screen is 1920 * 1080.
public static GetRatio ( ) : float
return float

Initiallize() public static method

Initiallizes the static variables used by this static public class..
public static Initiallize ( ) : void
return void