public void DrawSprite(int x, int y, int width, int height, string image, Color color, bool flipX) { this.m_Context.SpriteBatch.Draw( this.m_Context.Textures[image], new Rectangle(x, y, width, height), null, color.ToPremultiplied(), 0, new Vector2(0, 0), SpriteEffects.FlipHorizontally, 0 ); }
public void DrawSprite(int x, int y, int width, int height, string image, Color color, bool flipX, double rotation = 0, Vector2? origin = null) { if (!this.m_Context.Textures.ContainsKey(image)) throw new InvalidOperationException("The image '" + image + "' has not yet been loaded."); this.m_Context.SpriteBatch.Draw( this.m_Context.Textures[image], new Rectangle(x, y, width, height), null, color.ToPremultiplied(), (float)rotation, origin ?? new Vector2(0, 0), SpriteEffects.FlipHorizontally, 0 ); }
protected virtual void DrawSpriteAt(GameContext context, float x, float y, int width, int height, string image, Color color, bool flipX) { if (flipX) { context.SpriteBatch.Draw( context.Textures[image], new Rectangle((int)x, (int)y, width, height), null, color.ToPremultiplied(), 0, new Vector2(0, 0), SpriteEffects.FlipHorizontally, 0 ); } else { context.SpriteBatch.Draw( context.Textures[image], new Rectangle((int)x, (int)y, width, height), color.ToPremultiplied() ); } }
private void DrawSpriteAt(GameContext context, float x, float y, int width, int height, string image, Color color, bool flipX) { if (flipX) context.SpriteBatch.Draw( context.Textures[image], new Rectangle((int)x, (int)y, width, height), null, color.ToPremultiplied(), 0, new Vector2(0, 0), SpriteEffects.FlipHorizontally, 0 ); else context.SpriteBatch.Draw( context.Textures[image], new Rectangle((int)x, (int)y, width, height), color.ToPremultiplied() ); }
private void DrawSpriteAt(GameContext context, float x, float y, int width, int height, string image, Color color, bool flipX, double rotation, Vector2 origin) { if (!context.Textures.ContainsKey(image)) throw new InvalidOperationException("The image '" + image + "' has not yet been loaded."); if (flipX) context.SpriteBatch.Draw( context.Textures[image], new Rectangle((int)x, (int)y, width, height), null, color.ToPremultiplied(), (float)rotation, origin, SpriteEffects.FlipHorizontally, 0 ); else context.SpriteBatch.Draw( context.Textures[image], new Rectangle((int)x, (int)y, width, height), null, color.ToPremultiplied(), (float)rotation, origin, SpriteEffects.None, 0 ); }