diff --git a/SpriteLibrary/SpriteEntryForm.Designer.cs b/SpriteLibrary/SpriteEntryForm.Designer.cs
index 4d2e0ec..c236679 100644
--- a/SpriteLibrary/SpriteEntryForm.Designer.cs
+++ b/SpriteLibrary/SpriteEntryForm.Designer.cs
@@ -49,6 +49,7 @@
this.lblCountSprites = new System.Windows.Forms.Label();
this.TCTabPages = new System.Windows.Forms.TabControl();
this.tpFromImage = new System.Windows.Forms.TabPage();
+ this.lblAnimationNumber = new System.Windows.Forms.Label();
this.lblAnimationFwdBack = new System.Windows.Forms.Label();
this.btnAnimBack = new System.Windows.Forms.Button();
this.btnAnimFwd = new System.Windows.Forms.Button();
@@ -69,7 +70,6 @@
this.btnReset = new System.Windows.Forms.Button();
this.btnPreviewAnimFwd = new System.Windows.Forms.Button();
this.btnPreviewAnimBack = new System.Windows.Forms.Button();
- this.lblAnimationNumber = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pbImageField)).BeginInit();
this.TCTabPages.SuspendLayout();
this.tpFromImage.SuspendLayout();
@@ -283,6 +283,15 @@
this.tpFromImage.Text = "From Image";
this.tpFromImage.UseVisualStyleBackColor = true;
//
+ // lblAnimationNumber
+ //
+ this.lblAnimationNumber.AutoSize = true;
+ this.lblAnimationNumber.Location = new System.Drawing.Point(190, 91);
+ this.lblAnimationNumber.Name = "lblAnimationNumber";
+ this.lblAnimationNumber.Size = new System.Drawing.Size(16, 17);
+ this.lblAnimationNumber.TabIndex = 21;
+ this.lblAnimationNumber.Text = "0";
+ //
// lblAnimationFwdBack
//
this.lblAnimationFwdBack.AutoSize = true;
@@ -463,6 +472,7 @@
this.btnReset.TabIndex = 24;
this.btnReset.Text = "Reset";
this.btnReset.UseVisualStyleBackColor = true;
+ this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// btnPreviewAnimFwd
//
@@ -486,15 +496,6 @@
this.btnPreviewAnimBack.UseVisualStyleBackColor = true;
this.btnPreviewAnimBack.Click += new System.EventHandler(this.btnPreviewAnimBack_Click);
//
- // lblAnimationNumber
- //
- this.lblAnimationNumber.AutoSize = true;
- this.lblAnimationNumber.Location = new System.Drawing.Point(190, 91);
- this.lblAnimationNumber.Name = "lblAnimationNumber";
- this.lblAnimationNumber.Size = new System.Drawing.Size(16, 17);
- this.lblAnimationNumber.TabIndex = 21;
- this.lblAnimationNumber.Text = "0";
- //
// SpriteEntryForm
//
this.AcceptButton = this.btnApply;
diff --git a/SpriteLibrary/SpriteEntryForm.cs b/SpriteLibrary/SpriteEntryForm.cs
index e6ce6fd..94b42ad 100644
--- a/SpriteLibrary/SpriteEntryForm.cs
+++ b/SpriteLibrary/SpriteEntryForm.cs
@@ -170,23 +170,64 @@ namespace SpriteLibrary
UpdateHighlightBox();
}
+ ///
+ /// If multiple frames are selected, retrieve all of their rectangles
+ ///
+ ///
+ private List AnimationFrameAreas()
+ {
+ List Frames = new List();
+ Point start = ChosenArea.Location;
+ int animations;
+ int.TryParse(tbNumFrames.Text, out animations);
+ Frames.Add(ChosenArea);
+ Image tImage = myDatabase.GetImageFromName(cbStartingImage.SelectedItem.ToString(), true);
+
+ for (int i=1; i< animations; i++)
+ {
+ start = new Point(start.X + ChosenArea.Width, start.Y);
+ if(start.X >= tImage.Width)
+ {
+ start.X = 0;
+ start.Y += ChosenArea.Height;
+ }
+ Rectangle tRec = new Rectangle(start.X, start.Y, ChosenArea.Width, ChosenArea.Height);
+ Frames.Add(tRec);
+ }
+ return Frames;
+ }
+
private void UpdateHighlightBox()
{
int transparency = 50;
Image NewFrontImage = new Bitmap(pbImageField.BackgroundImage.Width, pbImageField.BackgroundImage.Height);
- Color FillColor = Color.Green;
+ Color FillColor = Color.Gray;
Brush brush = new SolidBrush(Color.FromArgb(transparency, FillColor.R, FillColor.G, FillColor.B));
Brush nobrush = new SolidBrush(Color.FromArgb(0,0,0,0));
+ List areas = AnimationFrameAreas();
using (Graphics G = Graphics.FromImage(NewFrontImage))
{
G.FillRectangle(brush, 0,0,NewFrontImage.Width,NewFrontImage.Height);
GraphicsPath path = new GraphicsPath();
- path.AddRectangle(ChosenArea);
+ foreach (Rectangle one in areas)
+ {
+ path.AddRectangle(one);
+ }
G.SetClip(path);
G.Clear(Color.Transparent);
G.ResetClip();
- // G.FillRectangle(nobrush, ChosenArea);
-
+ transparency = 50;
+ FillColor = Color.Green;
+ int increment = 10;
+ if (areas.Count > 7) increment = 5;
+ foreach (Rectangle one in areas)
+ {
+ transparency += increment;
+ if (transparency > 150) transparency = 160;
+ brush = new SolidBrush(Color.FromArgb(transparency, FillColor.R, FillColor.G, FillColor.B));
+ G.FillRectangle(brush, one);
+ }
+
}
pbImageField.Image = NewFrontImage;
pbImageField.SizeMode = PictureBoxSizeMode.StretchImage;
@@ -209,14 +250,11 @@ namespace SpriteLibrary
private void cbStartingImage_SelectedIndexChanged(object sender, EventArgs e)
{
- ResourceManager rm;
- if (myResources != null) rm = myResources;
- else rm = Properties.Resources.ResourceManager;
//We have a selected item
if (cbStartingImage.SelectedIndex >= 0)
{
//Load in a new image into our background
- Image NewImage = (Bitmap)rm.GetObject(cbStartingImage.SelectedItem.ToString());
+ Image NewImage = myDatabase.GetImageFromName(cbStartingImage.SelectedItem.ToString(),true);
if (NewImage != null)
{
MyController.ReplaceOriginalImage(new Bitmap(NewImage));
@@ -571,5 +609,10 @@ namespace SpriteLibrary
PreviewSprite.ChangeAnimation(NextAnim);
}
}
+
+ private void btnReset_Click(object sender, EventArgs e)
+ {
+ SpriteInformationToForm();
+ }
}
}