Ejemplo n.º 1
0
        /// <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;
        }
Ejemplo n.º 2
0
        public BitmapFont(Texture texture, int charWidth, int charHeight, int charOffset = 32) : this(texture) {
            CharacterWidth = charWidth;
            CharacterHeight = charHeight;
            CharCodeOffset = charOffset;

            LineSpacing = CharacterHeight;
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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)));
        }
Ejemplo n.º 6
0
 public BitmapFont(Texture texture) {
     Texture = texture;
     DataType = BitmapFontDataType.None;
 }
Ejemplo n.º 7
0
 /// <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();
 }
Ejemplo n.º 8
0
 /// <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);
 }
Ejemplo n.º 9
0
        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;
        }
Ejemplo n.º 10
0
        /// <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));
        }
Ejemplo n.º 11
0
 public PixelCollider(Texture texture, Enum tag, params Enum[] tags) : this(texture) {
     AddTag(tag);
     AddTag(tags);
 }
Ejemplo n.º 12
0
 /// <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);
 }
Ejemplo n.º 13
0
 /// <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);
 }
Ejemplo n.º 14
0
 /// <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);
 }
Ejemplo n.º 15
0
 /// <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);
 }
Ejemplo n.º 16
0
 /// <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);
 }
Ejemplo n.º 17
0
 /// <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);
 }