From 8e502e3b1ee0bb4a1825d66de8d9a9ee5c4d5e9c Mon Sep 17 00:00:00 2001 From: Tim Young Date: Mon, 18 Sep 2017 07:55:52 -0500 Subject: [PATCH] finish save by pulling info from form to the sprite information record --- SpriteLibrary/SpriteEntryForm.cs | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/SpriteLibrary/SpriteEntryForm.cs b/SpriteLibrary/SpriteEntryForm.cs index 8810bc7..f2e6cde 100644 --- a/SpriteLibrary/SpriteEntryForm.cs +++ b/SpriteLibrary/SpriteEntryForm.cs @@ -222,6 +222,44 @@ namespace SpriteLibrary } } + /// + /// Take the values stored in TempInformation and push it out to our form + /// + private void FormToSpriteInformation() + { + if (TempInformation == null) return; + //For the main sprite information + + TempInformation.SpriteName = tbSpriteName.Text; + int.TryParse(tbDefaultSize.Text, out TempInformation.ViewPercent); + + //From the current animation + AnimationInfo AI = null; + if (CurrentSIAnimation < 0) CurrentSIAnimation = 0; + if (CurrentSIAnimation >= TempInformation.Animations.Count) CurrentSIAnimation = TempInformation.Animations.Count - 1; + if (CurrentSIAnimation < TempInformation.Animations.Count) + { + AI = TempInformation.Animations[CurrentSIAnimation]; + + int.TryParse(tbAmimationSpeed.Text, out AI.AnimSpeed); + AI.ImageName = cbStartingImage.Text; + + AI.MirrorHorizontally = cbMirrorH.Checked; + AI.MirrorVertically = cbMirrorV.Checked; + + int.TryParse(cbAnimation.Text, out AI.AnimationToUse); + int.TryParse(tbNumFrames.Text, out AI.NumFrames); + + AI.StartPoint = ChosenArea.Location; + AI.Width = ChosenArea.Width; + AI.Height = ChosenArea.Height; + + if (rbFromImage.Checked) AI.FieldsToUse = AnimationType.SpriteDefinition; + if (rbMirror.Checked) AI.FieldsToUse = AnimationType.Mirror; + if (rbRotation.Checked) AI.FieldsToUse = AnimationType.Rotation; + } + } + /// /// Given two locations that we have clicked on, find the area we have selected /// @@ -283,6 +321,7 @@ namespace SpriteLibrary private void btnApply_Click(object sender, EventArgs e) { + FormToSpriteInformation(); if(CurrentSIIndex >0 && CurrentSIIndex < SpriteInformation.Count) { SpriteInformation[CurrentSIIndex].CopyFrom(TempInformation);