Пример #1
0
 /// <summary>
 /// Renders a Sprite using the given parameters.
 /// </summary>
 /// <param name="record">The sprite to render.</param>
 /// <param name="frame">The frame to render.</param>
 /// <param name="position">The position to render it at.</param>
 /// <param name="color">The Color to blend with.</param>
 /// <param name="alpha">The transparency to use.</param>
 /// <param name="origin">The origin of the Texture.</param>
 /// <param name="scale">The scaling factors.</param>
 /// <param name="rotation">The rotation.</param>
 public static void Sprite(SpriteDefinition record, int frame, Vector2 position, Color color, float alpha, Vector2 origin, Vector2 scale, Angle rotation)
 {
     Texture(record.Texture, record[frame], position, color, alpha, origin, scale, rotation);
 }
Пример #2
0
 /// <summary>
 /// Renders a Sprite using the current rendering state.
 /// </summary>
 /// <param name="sprite">The sprite to render.</param>
 /// <param name="frame">The frame to render.</param>
 public static void Sprite(SpriteDefinition sprite, int frame)
 {
     Texture(sprite.Texture, sprite[frame]);
 }
Пример #3
0
 /// <summary>
 /// Renders a Sprite using the given position and color blending values.
 /// </summary>
 /// <param name="sprite">The sprite to render.</param>
 /// <param name="rect">The frame to render.</param>
 /// <param name="position">The position to render it at.</param>
 /// <param name="color">The Color to blend with.</param>
 /// <param name="alpha">The transparency to use.</param>
 public static void Sprite(SpriteDefinition record, int frame, Vector2 position, Color color, float alpha = 1.0f)
 {
     Texture(record.Texture, record[frame], position, color, alpha);
 }
Пример #4
0
 public Sprite(SpriteDefinition definition)
     : base(true)
 {
     Definition = definition;
     AnimationCollection = new SpriteAnimationCollection();
 }
Пример #5
0
        /// <summary>
        /// Sets the rendering sprite of the particle.
        /// </summary>
        /// <param name="sprite">The Sprite to render.</param>
        /// <param name="origin">The origin to render with.</param>
        /// <param name="mode">The frame mode of the particle.</param>
        /// <returns>The current ParticleType.</returns>
        public ParticleType SetSprite(SpriteDefinition sprite, Vector2 origin, FrameMode mode)
        {
            Sprite = sprite;
            Origin = origin;
            realOrigin = (OriginInPixels ? Origin : Origin * sprite.Size);
            Mode = mode;

            if (shouldSetScaleByPixels)
            {
                Size.Min = pixelMin / Sprite.Diagonal;
                Size.Max = pixelMax / Sprite.Diagonal;
            }

            return this;
        }
Пример #6
0
 public SpriteRecord(string name, string subtexture, int width, int height)
 {
     Width = width;
     Height = height;
     TextureName = name;
     SubtextureName = subtexture;
     Definition = null;
     Animations = new Dictionary<string, SpriteAnimation>();
 }
Пример #7
0
 /// <summary>
 /// Retrieves the SpriteAnimation associated with the given sprite and animation key.
 /// </summary>
 public SpriteAnimation GetSpriteAnimation(SpriteDefinition sprite, string animName)
 {
     foreach(var s in sprites)
         if (s.Value.Definition == sprite)
             return s.Value.Animations.ContainsKey(animName) ? s.Value.Animations[animName] : null;
     return null;
 }
Пример #8
0
 public override void Unload()
 {
     selfSprite = null;
 }