public void Clear() { selectedFrame = null; animations = null; selectedPart = -1; selectedAnimation = -1; textureOffset = Vector2.Zero; currentTexture = null; }
public Game1(IntPtr drawSurface) { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; graphics.ApplyChanges(); this.drawSurface = drawSurface; graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings); System.Windows.Forms.Control.FromHandle((this.Window.Handle)).VisibleChanged += new EventHandler(Game1_VisibleChanged); animations = new AnimationCollection(); Reset(); }
public void SetAnimationCollection(AnimationCollection aniColl) { listBoxFrames.Items.AddRange(aniColl.allFrames.ToArray()); listBoxAnimations.Items.AddRange(aniColl.animations.ToArray()); }
public static void Save(AnimationCollection a, string path) { using (StreamWriter w = new StreamWriter(path, false)) { //Metadata separate by | w.WriteLine(a.name + "|" + a.texture); //1. Framecount w.WriteLine(a.allFrames.Count); //2. Frames foreach (Frame f in a.allFrames) { w.WriteLine(f.name); //2.1 Parts w.WriteLine(f.parts.Count); foreach (Entity e in f.parts) { w.WriteLine(e.position.X.ToString(CultureInfo.InvariantCulture) + "|" + e.position.Y.ToString(CultureInfo.InvariantCulture)); w.WriteLine(e.rotation.ToString(CultureInfo.InvariantCulture)); w.WriteLine(e.scale.ToString(CultureInfo.InvariantCulture)); w.WriteLine(e.flipped); w.WriteLine(e.Source.X + "|" + e.Source.Y + "|" + e.Source.Width + "|" + e.Source.Height); } } //3. AnimationCount w.WriteLine(a.animations.Count); //4. Animations foreach (Animation ani in a.animations) { w.WriteLine(ani.name); //4.1 Keyframes w.WriteLine(ani.KeyFrames.Count); foreach (KeyFrame kf in ani.KeyFrames) { w.WriteLine(a.allFrames.IndexOf(kf.Frame)); w.WriteLine(kf.Duration.ToString(CultureInfo.InvariantCulture)); //4.1.1 Scripts w.WriteLine(kf.Scripts.Length); foreach (string s in kf.Scripts) { w.WriteLine(s); } } } } }