Exemplo n.º 1
0
        public static void AddTrailPosition(SmartSprite sprite, float duration)
        {
            CheckInitialized();
            SmartSprite spr = new SmartSprite(sprite.Sprite.Texture);

            spr.Sprite.Origin = sprite.Sprite.Origin;
            spr.Rotation      = sprite.Rotation;
            spr.Fade(duration);
            spr.Position = sprite.Position;

            _sprites.Add(spr);
        }
Exemplo n.º 2
0
 public Animation(string fileName, IntRect spriteSize, uint numberOfSprites, float singleImageTime = 0.3f)
 {
     _spriteList      = new List <SmartSprite>();
     _order           = new List <int>();
     SingleImageTime  = singleImageTime;
     _currentTime     = singleImageTime;
     _currentPosition = 0;
     SFML.Graphics.Texture text = JamUtilities.TextureManager.GetTextureFromFileName(fileName);
     for (int i = 0; i < numberOfSprites; i++)
     {
         //System.Console.WriteLine(i);
         IntRect     rect = new IntRect(i * spriteSize.Width, 0, spriteSize.Width, spriteSize.Height);
         SmartSprite spr  = new SmartSprite(text, rect);
         _spriteList.Add(spr);
         _order.Add(i);
     }
 }
Exemplo n.º 3
0
        public Animation(string fileName, Vector2u spriteSize)
        {
            _sprites = new List <SmartSprite>();
            Texture t = JamUtilities.TextureManager.GetTextureFromFileName(fileName);

            if (spriteSize.X > t.Size.X || spriteSize.Y > t.Size.Y)
            {
                throw new ArgumentOutOfRangeException("spriteSize", "selection area out of texture.");
            }

            uint maxIdx = t.Size.X / spriteSize.X;

            for (uint i = 0; i != maxIdx; ++i)
            {
                IntRect     rect = new IntRect((int)(i * spriteSize.X), 0, (int)(spriteSize.X), (int)(spriteSize.Y));
                SmartSprite spr  = new SmartSprite(t, rect);
                _sprites.Add(spr);
            }

            _storedAnimations = new List <AnimationProperties>();
        }