Default2DRenderUtilities

Warning

This documentation is for an implementation of a service. This class is not meant to be used directly; instead use the I2DRenderUtilities service via dependency injection to access this functionality.

Information documented here may not be up to date.

class Default2DRenderUtilities : System.Object, I2DRenderUtilities

An implementation of T:Protogame.I2DRenderUtilities.

public Vector2 MeasureText(IRenderContext context, string text, Protogame.IAssetReference<FontAsset> font)
Parameters:
  • context (Protogame.IRenderContext) –
  • text (string) –
  • font (Protogame.IAssetReference<FontAsset>) –
public void RenderLine(IRenderContext context, Vector2 start, Vector2 end, Color color, float width)
Parameters:
  • context (Protogame.IRenderContext) –
  • start (Microsoft.Xna.Framework.Vector2) –
  • end (Microsoft.Xna.Framework.Vector2) –
  • color (Microsoft.Xna.Framework.Color) –
  • width (float) –
public void RenderRectangle(IRenderContext context, Rectangle rectangle, Color color, bool filled)
Parameters:
  • context (Protogame.IRenderContext) –
  • rectangle (Microsoft.Xna.Framework.Rectangle) –
  • color (Microsoft.Xna.Framework.Color) –
  • filled (bool) –
public void RenderText(IRenderContext context, Vector2 position, string text, Protogame.IAssetReference<FontAsset> font, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, System.Nullable<Color> textColor, bool renderShadow, System.Nullable<Color> shadowColor, System.Nullable<Single> rotation, System.Nullable<Vector2> origin, System.Nullable<Vector2> scale, bool ensureAligned)
Parameters:
  • context (Protogame.IRenderContext) –
  • position (Microsoft.Xna.Framework.Vector2) –
  • text (string) –
  • font (Protogame.IAssetReference<FontAsset>) –
  • horizontalAlignment (Protogame.HorizontalAlignment) –
  • verticalAlignment (Protogame.VerticalAlignment) –
  • textColor (System.Nullable<Color>) –
  • renderShadow (bool) –
  • shadowColor (System.Nullable<Color>) –
  • rotation (System.Nullable<Single>) –
  • origin (System.Nullable<Vector2>) –
  • scale (System.Nullable<Vector2>) –
  • ensureAligned (bool) –
public void RenderTexture(IRenderContext context, Vector2 position, Protogame.IAssetReference<TextureAsset> texture, System.Nullable<Vector2> size, System.Nullable<Color> color, float rotation, System.Nullable<Vector2> rotationAnchor, bool flipHorizontally, bool flipVertically, System.Nullable<Rectangle> sourceArea)
Parameters:
  • context (Protogame.IRenderContext) –
  • position (Microsoft.Xna.Framework.Vector2) –
  • texture (Protogame.IAssetReference<TextureAsset>) –
  • size (System.Nullable<Vector2>) –
  • color (System.Nullable<Color>) –
  • rotation (float) –
  • rotationAnchor (System.Nullable<Vector2>) –
  • flipHorizontally (bool) –
  • flipVertically (bool) –
  • sourceArea (System.Nullable<Rectangle>) –
public void RenderTexture(IRenderContext context, Vector2 position, Texture2D texture, System.Nullable<Vector2> size, System.Nullable<Color> color, float rotation, System.Nullable<Vector2> rotationAnchor, bool flipHorizontally, bool flipVertically, System.Nullable<Rectangle> sourceArea)
Parameters:
  • context (Protogame.IRenderContext) –
  • position (Microsoft.Xna.Framework.Vector2) –
  • texture (Microsoft.Xna.Framework.Graphics.Texture2D) –
  • size (System.Nullable<Vector2>) –
  • color (System.Nullable<Color>) –
  • rotation (float) –
  • rotationAnchor (System.Nullable<Vector2>) –
  • flipHorizontally (bool) –
  • flipVertically (bool) –
  • sourceArea (System.Nullable<Rectangle>) –
public void RenderCircle(IRenderContext context, Vector2 center, int radius, Color color, bool filled)
Parameters:
  • context (Protogame.IRenderContext) –
  • center (Microsoft.Xna.Framework.Vector2) –
  • radius (int) –
  • color (Microsoft.Xna.Framework.Color) –
  • filled (bool) –
public void SuspendSpriteBatch(IRenderContext renderContext)
Parameters:
  • renderContext (Protogame.IRenderContext) –
public void ResumeSpriteBatch(IRenderContext renderContext)
Parameters:
  • renderContext (Protogame.IRenderContext) –