예제 #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);
        }
예제 #3
0
 public StaticSprite(StaticSpriteDefinition definition, SpriteInfo spriteInfo)
     : base(spriteInfo)
 {
     _definition = definition;
 }
예제 #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);
 }
예제 #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);
        }
예제 #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;
            }
        }
예제 #7
0
 public AnimatedSprite(AnimatedSpriteDefinition definition, SpriteInfo spriteInfo, AnimationInfo animInfo)
     : base(spriteInfo)
 {
     _definition = definition;
 }
예제 #8
0
 public AnimatedSprite(AnimatedSpriteDefinition definition, SpriteInfo spriteInfo)
     : base(spriteInfo)
 {
     _definition = definition;
     _animData = new AnimationInfo();
 }
예제 #9
0
 public Sprite(SpriteInfo spriteInfo)
 {
     _spriteInfo = spriteInfo;
 }
예제 #10
0
 public Sprite()
 {
     _spriteInfo = new SpriteInfo();
     _spriteInfo.Opacity = 1;
 }
예제 #11
0
 public void Draw(SpriteBatch spriteBatch, PointFP position, AnimationInfo animData, SpriteInfo spriteData)
 {
     _frames[animData.CurrentFrameIndex].Frame.Draw(spriteBatch, position, spriteData);
 }