public static PicRef GetOrCreate(string name) { PicRef pr = PicRef.Get(name); if (pr != null) { return(pr); } return(PicRef.Create(name)); }
public static List <PicRef> CreatePicRefs(Endogine.ResourceManagement.MemberBitmapBase mb, int numFramesOnX, int numFramesTotal) { List <string> animRefs = new List <string>(); List <PicRef> picRefs = new List <PicRef>(); int numFramesOnY = numFramesTotal / numFramesOnX; EPoint frameSize = new EPoint(mb.Size.X / numFramesOnX, mb.Size.Y / numFramesOnY); for (int i = 0; i < numFramesTotal; i++) { string picRefName = mb.Name + "_" + i; int x = i % numFramesOnX; int y = i / numFramesOnX; PicRef pr = PicRef.Create((MemberSpriteBitmap)mb, picRefName); pr.SourceRectangle = new ERectangle(x * frameSize.X, y * frameSize.Y, frameSize.X, frameSize.Y); picRefs.Add(pr); animRefs.Add(picRefName); } EH.Instance.CastLib.FrameSets.AddFrameSet(mb.Name, animRefs); return(picRefs); }
public static PicRef Create(string fileName) { MemberSpriteBitmap mb = (MemberSpriteBitmap)EH.Instance.CastLib.GetOrCreate(fileName); return(PicRef.Create(mb, fileName)); }