Ejemplo n.º 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);
 }
Ejemplo n.º 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]);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 4
0
 public Sprite(SpriteDefinition definition)
     : base(true)
 {
     Definition = definition;
     AnimationCollection = new SpriteAnimationCollection();
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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>();
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 8
0
 public override void Unload()
 {
     selfSprite = null;
 }