finish save by pulling info from form to the sprite information record

This commit is contained in:
Tim Young 2017-09-18 07:55:52 -05:00
parent 795a4c6ce7
commit 8e502e3b1e
1 changed files with 39 additions and 0 deletions

View File

@ -222,6 +222,44 @@ namespace SpriteLibrary
}
}
/// <summary>
/// Take the values stored in TempInformation and push it out to our form
/// </summary>
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;
}
}
/// <summary>
/// Given two locations that we have clicked on, find the area we have selected
/// </summary>
@ -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);