Preview animations fwd/back buttons working

This commit is contained in:
Tim Young 2017-09-19 08:42:04 -05:00
parent 8067b91759
commit fb0771a474
2 changed files with 24 additions and 0 deletions

View File

@ -471,6 +471,7 @@
this.btnPreviewAnimFwd.TabIndex = 25;
this.btnPreviewAnimFwd.Text = ">";
this.btnPreviewAnimFwd.UseVisualStyleBackColor = true;
this.btnPreviewAnimFwd.Click += new System.EventHandler(this.btnPreviewAnimFwd_Click);
//
// btnPreviewAnimBack
//
@ -481,6 +482,7 @@
this.btnPreviewAnimBack.TabIndex = 26;
this.btnPreviewAnimBack.Text = "<";
this.btnPreviewAnimBack.UseVisualStyleBackColor = true;
this.btnPreviewAnimBack.Click += new System.EventHandler(this.btnPreviewAnimBack_Click);
//
// SpriteEntryForm
//

View File

@ -452,5 +452,27 @@ namespace SpriteLibrary
PreviewSprite.PutBaseImageLocation(new Point(1, 1));
//PreviewSprite.SetSize(new Size(50, 50));
}
private void btnPreviewAnimBack_Click(object sender, EventArgs e)
{
if(PreviewSprite != null)
{
int Animations = PreviewSprite.AnimationCount;
int NextAnim = PreviewSprite.AnimationIndex - 1;
if (NextAnim < 0) NextAnim = Animations - 1;
PreviewSprite.ChangeAnimation(NextAnim);
}
}
private void btnPreviewAnimFwd_Click(object sender, EventArgs e)
{
if (PreviewSprite != null)
{
int Animations = PreviewSprite.AnimationCount;
int NextAnim = PreviewSprite.AnimationIndex + 1;
if (NextAnim >= Animations) NextAnim = 0;
PreviewSprite.ChangeAnimation(NextAnim);
}
}
}
}