示例#1
0
 /// <summary>
 /// Draws a line from point1 to point2 with an offset
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="point">The starting point</param>
 /// <param name="length">The length of the line</param>
 /// <param name="angle">The angle of this line from the starting point</param>
 /// <param name="color">The color to use</param>
 /// <param name="thickness">The thickness of the line</param>
 public static void DrawLine(this SpriteBatch spriteBatch, Vector2 point, float length, float angle, Color color, float thickness)
 {
     // stretch the pixel between the two vectors
     spriteBatch.Draw(spriteBatch.BlankTexture(),
                      point,
                      null,
                      color,
                      angle,
                      new Vector2(0, (float)spriteBatch.BlankTexture().Height / 2),
                      new Vector2(length, thickness),
                      SpriteEffects.None,
                      0);
 }
示例#2
0
 /// <summary>
 /// Draws a filled rectangle
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="location">Where to draw</param>
 /// <param name="size">The size of the rectangle</param>
 /// <param name="angle">The angle in radians to draw the rectangle at</param>
 /// <param name="color">The color to draw the rectangle in</param>
 public static void FillRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color, float angle)
 {
     // stretch the pixel between the two vectors
     spriteBatch.Draw(spriteBatch.BlankTexture(),
                      location,
                      null,
                      color,
                      angle,
                      Vector2.Zero,
                      size,
                      SpriteEffects.None,
                      0);
 }
示例#3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            // TODO: Add your drawing code here

            base.Draw(gameTime);

            //HACK: workaround for blue background only in renderarea
            spriteBatch.Begin();
            spriteBatch.Draw(spriteBatch.BlankTexture(), WindowSettings.RenderArea, Color.CornflowerBlue);
            spriteBatch.End();

            GameScene.ActiveScene.Draw(gameTime);

            this.sceneManager.Draw(gameTime);
        }
示例#4
0
 public static void PutPixel(this SpriteBatch spriteBatch, Vector2 position, Color color)
 {
     spriteBatch.Draw(spriteBatch.BlankTexture(), position, color);
 }
示例#5
0
 /// <summary>
 /// Draws a filled rectangle
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="rect">The rectangle to draw</param>
 /// <param name="color">The color to draw the rectangle in</param>
 /// <param name="angle">The angle in radians to draw the rectangle at</param>
 public static void FillRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color, float angle)
 {
     spriteBatch.Draw(spriteBatch.BlankTexture(), rect, null, color, angle, Vector2.Zero, SpriteEffects.None, 0);
 }
示例#6
0
 /// <summary>
 /// Draws a filled rectangle
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="rect">The rectangle to draw</param>
 /// <param name="color">The color to draw the rectangle in</param>
 public static void FillRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color)
 {
     // Simply use the function already there
     spriteBatch.Draw(spriteBatch.BlankTexture(), rect, color);
 }