Exemplo n.º 1
0
        public Counter(CounterDefinition definition, SpriteInfo spriteInfo)
            : base(spriteInfo)
        {
            _definition = definition;

            Value = 0;
        }
        public DirectionalAnimatedSprite(DirectionalAnimatedSpriteDefinition definition, SpriteInfo spriteInfo)
            : base(spriteInfo)
        {
            _definition = definition;

            _anims = new AnimatedSprite[16];
            for (int i = 0; i < 16; i++)
                if (_definition[(Direction)i] != null)
                    _anims[i] = new AnimatedSprite(_definition[(Direction)i], SpriteInfo);
        }
Exemplo n.º 3
0
 public StaticSprite(StaticSpriteDefinition definition, SpriteInfo spriteInfo)
     : base(spriteInfo)
 {
     _definition = definition;
 }
Exemplo n.º 4
0
 public void Draw(SpriteBatch spriteBatch, PointFP position, SpriteInfo spriteData)
 {
     Vector2 p = new Vector2(position.X.Floor, position.Y.Floor);
     spriteBatch.Draw(_texture, p, _source,
         spriteData.BlendColor * spriteData.Opacity, spriteData.Rotation, Origin, spriteData.Scale, spriteData.Effects, 0);
 }
Exemplo n.º 5
0
        internal PointFP CalculateSize(List<int> digitList, SpriteInfo spriteInfo)
        {
            FPInt width = 0;
            FPInt height = 0;

            foreach (int digitIndex in digitList) {
                width += (FPInt)(_digitFrames[digitIndex].Width * spriteInfo.Scale);
                height = (FPInt)FPMath.Max(height, (FPInt)(_digitFrames[digitIndex].Height * spriteInfo.Scale));
            }

            if (digitList.Count > 1)
                width += DigitSpacing * (digitList.Count - 1);

            return new PointFP(width, height);
        }
Exemplo n.º 6
0
        public void Draw(SpriteBatch spriteBatch, PointFP position, SpriteInfo spriteData, List<int> digitIndexList)
        {
            FPInt width = -DigitSpacing;
            FPInt height = 0;
            foreach (int digitIndex in digitIndexList) {
                width += (FPInt)(_digitFrames[digitIndex].Width * spriteData.Scale) + DigitSpacing;
                height = FPMath.Max(height, (FPInt)(_digitFrames[digitIndex].Height * spriteData.Scale));
            }

            FPInt x = position.X - width / 2;
            FPInt y = position.Y - height / 2;
            foreach (int digitIndex in digitIndexList) {
                _digitFrames[digitIndex].Draw(spriteBatch, new PointFP(x, y), spriteData);
                x += (FPInt)(_digitFrames[digitIndex].Width * spriteData.Scale) + DigitSpacing;
            }
        }
Exemplo n.º 7
0
 public AnimatedSprite(AnimatedSpriteDefinition definition, SpriteInfo spriteInfo, AnimationInfo animInfo)
     : base(spriteInfo)
 {
     _definition = definition;
 }
Exemplo n.º 8
0
 public AnimatedSprite(AnimatedSpriteDefinition definition, SpriteInfo spriteInfo)
     : base(spriteInfo)
 {
     _definition = definition;
     _animData = new AnimationInfo();
 }
Exemplo n.º 9
0
 public Sprite(SpriteInfo spriteInfo)
 {
     _spriteInfo = spriteInfo;
 }
Exemplo n.º 10
0
 public Sprite()
 {
     _spriteInfo = new SpriteInfo();
     _spriteInfo.Opacity = 1;
 }
Exemplo n.º 11
0
 public void Draw(SpriteBatch spriteBatch, PointFP position, AnimationInfo animData, SpriteInfo spriteData)
 {
     _frames[animData.CurrentFrameIndex].Frame.Draw(spriteBatch, position, spriteData);
 }