Sphere.Core.Spriteset.GetImage C# (CSharp) Method

GetImage() public method

Returns an image based on the given index.
public GetImage ( int index ) : Image
index int The image index to use.
return Image
        public Image GetImage(int index)
        {
            return _images[index];
        }

Same methods

Spriteset::GetImage ( string direction, int frame ) : Image

Usage Example

示例#1
0
 /// <summary>
 /// Get an image representation of this trigger / person
 /// </summary>
 /// <param name="rootpath">The root path of the project to find the spriteset.</param>
 /// <returns>A System.Draw.Bitmap representing the entity.</returns>
 public Image GetSSImage(string rootpath)
 {
     if (Type == EntityType.Trigger) return Properties.Resources.trigger;
     using (var s = new Spriteset())
     {
         if (s.Load(rootpath + "/spritesets/" + Spriteset))
         {
             Image img = s.GetImage("south");
             if (img == null && s.Images.Count > 0) img = s.Images[0];
             if (img != null)
             {
                 return s.Images.Count == 0 ? Properties.Resources.person : new Bitmap(img);
             }
         }
         return Properties.Resources.person;
     }
 }