/// <summary> /// Creates a new texture from a copy of another texture. No cache option for this. /// </summary> /// <param name="copy">The texture to copy from.</param> public Texture(Texture copy) { texture = new SFML.Graphics.Texture(copy.SFMLTexture); Source = copy.Source; texture.Smooth = DefaultSmooth; }
public BitmapFont(Texture texture, int charWidth, int charHeight, int charOffset = 32) : this(texture) { CharacterWidth = charWidth; CharacterHeight = charHeight; CharCodeOffset = charOffset; LineSpacing = CharacterHeight; }
public PixelCollider(Texture texture, params int[] tags) { this.texture = texture.SFMLTexture; collideImage = this.texture.CopyToImage(); Width = this.texture.Size.X; Height = this.texture.Size.Y; AddTag(tags); }
void InitializeTexture() { visibleTexture = new Texture((int)Width, (int)Height); for (var x = 0; x < Width; x++) { for (var y = 0; y < Height; y++) { if (PixelAt(x, y)) { visibleTexture.SetPixel(x, y, Color.Red); } else { visibleTexture.SetPixel(x, y, Color.None); } } } visibleImage = new Image(visibleTexture); }
public TestBullet(IProjectileLogic p) : base(p) { if (_texture == null) _texture = new Texture("Resources/Bullet.png"); var image = new Image(_texture); var collider = new PolygonCollider(_basePolygon, CollidableTags.Bullet); Utilities.RotatePolygon(Projectile.DegOrientation + 90, collider, _basePolygon); Projectile.AddCollider(collider); Projectile.AddGraphic(image); image.Angle = Projectile.DegOrientation + 90; _direction = new Vector2(16 * ((float)Math.Sin(Projectile.DegOrientation * Util.DEG_TO_RAD)), 16 * ((float)Math.Cos(Projectile.DegOrientation * Util.DEG_TO_RAD))); }
public BitmapFont(Texture texture) { Texture = texture; DataType = BitmapFontDataType.None; }
/// <summary> /// Create a new Decals object using a Texture. /// </summary> /// <param name="texture">The Texture to use.</param> public Decals(Texture texture) { SetTexture(texture); Initialize(); }
/// <summary> /// Create a new ImageSet from a Texture. /// </summary> /// <param name="texture">The Texture to use for the image sheet.</param> /// <param name="width">The width of each cell on the image sheet.</param> /// <param name="height">The height of each cell on the image sheet.</param> public ImageSet(Texture texture, int width, int height) : base(texture) { Initialize(width, height); }
public void CopyPixels(Texture from, int fromX, int fromY, int fromWidth, int fromHeight, int toX, int toY) { CreateImage(); from.CreateImage(); image.Copy(from.image, (uint)toX, (uint)toY, new SFML.Graphics.IntRect(fromX, fromY, fromWidth, fromHeight)); texture = new SFML.Graphics.Texture(image); needsUpdate = true; }
/// <summary> /// Copy pixels from one texture to another using blitting. /// </summary> /// <param name="from"></param> /// <param name="fromX"></param> /// <param name="fromY"></param> /// <param name="toX"></param> /// <param name="toY"></param> public void CopyPixels(Texture from, int fromX, int fromY, int toX, int toY) { CreateImage(); image.Copy(from.image, (uint)toX, (uint)toY, new SFML.Graphics.IntRect(fromX, fromY, from.Width, from.Height)); }
public PixelCollider(Texture texture, Enum tag, params Enum[] tags) : this(texture) { AddTag(tag); AddTag(tags); }
/// <summary> /// Set a parameter on the shader. /// </summary> /// <param name="name">The parameter in the shader to set.</param> /// <param name="texture">The texture to set it to.</param> public void SetParameter(Enum name, Texture texture) { SetParameter(Parameter(name), texture); }
/// <summary> /// Set a parameter on the shader. /// </summary> /// <param name="name">The parameter in the shader to set.</param> /// <param name="texture">The texture to set it to.</param> public void SetParameter(string name, Texture texture) { SFMLShader.SetParameter(name, texture.SFMLTexture); }
/// <summary> /// Create a new Particle. /// </summary> /// <param name="x">The x position.</param> /// <param name="y">The y position.</param> /// <param name="texture">The Texture to use for the ImageSet.</param> /// <param name="width">The width of the ImageSet cell.</param> /// <param name="height">The height of the ImageSet cell.</param> public Particle(float x, float y, Texture texture, int width = 0, int height = 0) : base(x, y) { Image = new ImageSet(texture, width, height); }
/// <summary> /// Set a parameter on the shader. /// </summary> /// <param name="name">The parameter in the shader to set.</param> /// <param name="texture">The texture to set it to.</param> public void SetParameter(string name, Texture texture) { shader.SetParameter(name, texture.SFMLTexture); }
/// <summary> /// Create a new NineSlice with a Texture. /// </summary> /// <param name="texture">The Texture to use.</param> /// <param name="width">The width of the NineSlice panel.</param> /// <param name="height">The height of the NineSlice panel.</param> /// <param name="fillRect">The rectangle to determine the stretched areas.</param> public NineSlice(Texture texture, int width, int height, Rectangle?fillRect = null) : base() { SetTexture(texture); Initialize(texture.Source, width, height, fillRect); }