public void DrawTexture(SFML.Graphics.Texture image, int x, int y, int rect_x, int rect_y, int rect_width, int rect_height, int width, int height, bool selected, int Transparency, bool fliph = false, bool flipv = false, int rotation = 0, Color?color = null) { if (!IsObjectOnScreen(x, y, width, height) || image == null) { return; } var zoom = GetZoom(); int real_x = (int)(x * zoom); int real_y = (int)(y * zoom); SFML.System.Vector2f size = new SFML.System.Vector2f(rect_width, rect_height); SFML.System.Vector2f center = new SFML.System.Vector2f(size.X / 2, size.Y / 2); SFML.System.Vector2f position = new SFML.System.Vector2f(real_x + center.X, real_y + center.Y); var textureRect = new IntRect(rect_x, rect_y, width, height); if (fliph || flipv) { if (fliph) { var temp = textureRect.Left; textureRect.Left = temp + textureRect.Width; textureRect.Width = -textureRect.Width; } if (flipv) { var temp = textureRect.Top; textureRect.Top = temp + textureRect.Height; textureRect.Height = -textureRect.Height; } } SFML.Graphics.RectangleShape rect = new SFML.Graphics.RectangleShape(); rect.Position = position; rect.Origin = center; rect.Rotation = rotation; rect.Size = size; rect.Texture = image; rect.FillColor = GetTransparency(color, Transparency); rect.TextureRect = textureRect; RenderWindow.Draw(rect); }
public void DrawTexture(SFML.Graphics.Texture image, int x, int y, int width, int height, bool selected, int transparency) { DrawTexture(image, x, y, 0, 0, width, height, selected, transparency); }