public void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle?sourceRectangle, Color color) { #if MONOGAME || FNA _renderer.Draw(texture, destinationRectangle, sourceRectangle, color * Opacity); #elif STRIDE _renderer.Draw(texture, destinationRectangle, sourceRectangle, color * Opacity, 0, Vector2.Zero); #else _renderer.Draw(texture, destinationRectangle, sourceRectangle, CrossEngineStuff.MultiplyColor(color, Opacity)); #endif }
/// <summary> /// Draws a rectangle with the thickness provided /// </summary> /// <param name="spriteBatch">The destination drawing surface</param> /// <param name="rectangle">The rectangle to draw</param> /// <param name="color">The color to draw the rectangle in</param> /// <param name="thickness">The thickness of the lines</param> public void DrawRectangle(Rectangle rectangle, Color color, float thickness = 1f) { var texture = DefaultAssets.WhiteTexture; var t = (int)thickness; var c = CrossEngineStuff.MultiplyColor(color, Opacity); // Top Draw(texture, new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, t), null, c); // Bottom Draw(texture, new Rectangle(rectangle.X, rectangle.Bottom - t, rectangle.Width, t), null, c); // Left Draw(texture, new Rectangle(rectangle.X, rectangle.Y, t, rectangle.Height), null, c); // Right Draw(texture, new Rectangle(rectangle.Right - t, rectangle.Y, t, rectangle.Height), null, c); }
/// <summary> /// Draws a text /// </summary> /// <param name="text">The text which will be drawn.</param> /// <param name="position">The drawing location on screen.</param> /// <param name="color">A color mask.</param> /// <param name="layerDepth">A depth of the layer of this string.</param> public void DrawString(SpriteFontBase font, string text, Vector2 position, Color color, float layerDepth = 0.0f) { font.DrawText(_renderer, text, position, CrossEngineStuff.MultiplyColor(color, Opacity), layerDepth); }