Example #1
0
 public override void Restore(Vector2 position, SpriteSheet spriteSheet, ObjectDataBase objectData)
 {
     base.Restore(position, spriteSheet, objectData);
     buttonCircle = new Circle(position
         + new Vector2(400 + spriteSheet.SourceRectangle(0).Width / 2, 280 + spriteSheet.SourceRectangle(0).Height / 2), 75);
     color = Color.Red;
 }
Example #2
0
        public override void Restore(Vector2 position, SpriteSheet spriteSheet, ObjectDataBase objectData)
        {
            const string CYPHERS_PATH = "Sprites/UI/HUD/Digit/cyphers";

            //this.cyphersTexture = Resources.Content.Load<Texture2D>(CYPHERS_PATH + id);
            cypherWidth = spriteSheet.SourceRectangle(0).Width;
            cypherHeight = spriteSheet.SourceRectangle(0).Height;
            cypherRect = new Rectangle(0, 0, cypherWidth, cypherHeight);

            base.Restore(position, spriteSheet, objectData);
        }
Example #3
0
 public static PhysicsFrame GetVerticesForTexture(SpriteSheet spriteSheet, int index)
 {
     Rectangle spriteSourceRect = spriteSheet.SourceRectangle(index);
     uint[] textureData = GetTextureData(spriteSheet, spriteSourceRect);
     return GetVerticesForTextureData(textureData, spriteSourceRect.Width);
 }
Example #4
0
        private void Rotate(int flips, SpriteSheet input, ref SpriteSheet output)
        {
            for (int i = 0; i < frames; i++)
            {
                input.Texture.GetData(0, input.SourceRectangle(i), textureOriginal, 0, textureOriginal.Length);

                for (int j = 0; j < flips; j++)
                {
                    for (int x = 0; x < size; x++)
                    {
                        for (int y = 0; y < size; y++)
                        {
                            textureFlipped[(x*size + size - y - 1)*PIXEL_SIZE + 0] = textureOriginal[(x + y*size)*PIXEL_SIZE + 0];
                            textureFlipped[(x*size + size -  y - 1)*PIXEL_SIZE + 1] = textureOriginal[(x + y*size)*PIXEL_SIZE + 1];
                            textureFlipped[(x*size + size -  y - 1)*PIXEL_SIZE + 2] = textureOriginal[(x + y*size)*PIXEL_SIZE + 2];
                            textureFlipped[(x*size + size -  y - 1)*PIXEL_SIZE + 3] = textureOriginal[(x + y*size)*PIXEL_SIZE + 3];
                        }
                    }
                }
                output.Texture.SetData(0, output.SourceRectangle(i), textureFlipped, 0, textureFlipped.Length);
            }
        }
Example #5
0
        public void Initialize()
        {
            const string MIDDLEBLOW_PATH = "Sprites/Blow/Middle/Sprites";
            const string CENTERBLOW_PATH = "Sprites/Blow/Center/Sprites";
            const string OUTERBLOW_PATH = "Sprites/Blow/Outer/Sprites";

            blowMiddle = new SpriteSheet[2];
            blowOuter = new SpriteSheet[4];

            blowCenter = GameResources.Content.Load<SpriteSheet>(CENTERBLOW_PATH);
            blowMiddle[0] = GameResources.Content.Load<SpriteSheet>(MIDDLEBLOW_PATH);
            blowMiddle[1] = blowMiddle[0].Copy();

            blowOuter[0] = GameResources.Content.Load<SpriteSheet>(OUTERBLOW_PATH);
            for (int i = 1; i < 4; i++)
            {
                blowOuter[i] = blowOuter[0].Copy();
            }

            size = blowCenter.SourceRectangle(0).Width;

            textureOriginal = new byte[size * size * PIXEL_SIZE];
            textureFlipped = new byte[size * size * PIXEL_SIZE];

            Rotate(2, blowMiddle[0], ref blowMiddle[1] );
            Rotate(1, blowOuter[0], ref blowOuter[1]);
            Rotate(1, blowOuter[1], ref blowOuter[2]);
            Rotate(1, blowOuter[2], ref blowOuter[3]);
        }