Set up an initial spriteinfo

This commit is contained in:
Tim Young 2017-09-16 19:08:46 -05:00
parent 7e22a57ca5
commit c438320a5e
2 changed files with 268 additions and 34 deletions

View File

@ -39,7 +39,7 @@
this.btnDone = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button();
this.btnNewSprite = new System.Windows.Forms.Button();
this.tbAmimationSpeed = new System.Windows.Forms.TextBox();
this.lblAnimationSpeed = new System.Windows.Forms.Label();
this.lblDefaultSize = new System.Windows.Forms.Label();
@ -47,7 +47,28 @@
this.btnBack = new System.Windows.Forms.Button();
this.btnFwd = new System.Windows.Forms.Button();
this.lblCountSprites = new System.Windows.Forms.Label();
this.tpRotateMirror = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.rbFromImage = new System.Windows.Forms.RadioButton();
this.rbRotation = new System.Windows.Forms.RadioButton();
this.rbMirror = new System.Windows.Forms.RadioButton();
this.btnNewAnimation = new System.Windows.Forms.Button();
this.pbPreview = new System.Windows.Forms.PictureBox();
this.btnPreview = new System.Windows.Forms.Button();
this.cbAnimation = new System.Windows.Forms.ComboBox();
this.lblWhichAnim = new System.Windows.Forms.Label();
this.tbRotation = new System.Windows.Forms.TextBox();
this.lblRotationDegrees = new System.Windows.Forms.Label();
this.cbMirrorV = new System.Windows.Forms.CheckBox();
this.cbMirrorH = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.pbImageField)).BeginInit();
this.tpRotateMirror.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbPreview)).BeginInit();
this.SuspendLayout();
//
// pbImageField
@ -57,14 +78,14 @@
this.pbImageField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pbImageField.Location = new System.Drawing.Point(5, 10);
this.pbImageField.Name = "pbImageField";
this.pbImageField.Size = new System.Drawing.Size(213, 253);
this.pbImageField.Size = new System.Drawing.Size(213, 306);
this.pbImageField.TabIndex = 0;
this.pbImageField.TabStop = false;
//
// cbStartingImage
//
this.cbStartingImage.FormattingEnabled = true;
this.cbStartingImage.Location = new System.Drawing.Point(349, 40);
this.cbStartingImage.Location = new System.Drawing.Point(128, 6);
this.cbStartingImage.Name = "cbStartingImage";
this.cbStartingImage.Size = new System.Drawing.Size(131, 24);
this.cbStartingImage.TabIndex = 1;
@ -73,7 +94,7 @@
// lblStartingImage
//
this.lblStartingImage.AutoSize = true;
this.lblStartingImage.Location = new System.Drawing.Point(244, 43);
this.lblStartingImage.Location = new System.Drawing.Point(23, 9);
this.lblStartingImage.Name = "lblStartingImage";
this.lblStartingImage.Size = new System.Drawing.Size(99, 17);
this.lblStartingImage.TabIndex = 2;
@ -82,7 +103,7 @@
// lblChosenArea
//
this.lblChosenArea.AutoSize = true;
this.lblChosenArea.Location = new System.Drawing.Point(350, 77);
this.lblChosenArea.Location = new System.Drawing.Point(129, 44);
this.lblChosenArea.Name = "lblChosenArea";
this.lblChosenArea.Size = new System.Drawing.Size(46, 17);
this.lblChosenArea.TabIndex = 3;
@ -90,7 +111,7 @@
//
// tbNumFrames
//
this.tbNumFrames.Location = new System.Drawing.Point(349, 109);
this.tbNumFrames.Location = new System.Drawing.Point(128, 75);
this.tbNumFrames.Name = "tbNumFrames";
this.tbNumFrames.Size = new System.Drawing.Size(47, 22);
this.tbNumFrames.TabIndex = 4;
@ -98,7 +119,7 @@
// lblFrames
//
this.lblFrames.AutoSize = true;
this.lblFrames.Location = new System.Drawing.Point(288, 109);
this.lblFrames.Location = new System.Drawing.Point(67, 75);
this.lblFrames.Name = "lblFrames";
this.lblFrames.Size = new System.Drawing.Size(55, 17);
this.lblFrames.TabIndex = 5;
@ -106,7 +127,7 @@
//
// tbSpriteName
//
this.tbSpriteName.Location = new System.Drawing.Point(349, 10);
this.tbSpriteName.Location = new System.Drawing.Point(356, 10);
this.tbSpriteName.Name = "tbSpriteName";
this.tbSpriteName.Size = new System.Drawing.Size(100, 22);
this.tbSpriteName.TabIndex = 6;
@ -114,7 +135,7 @@
// lblSpriteName
//
this.lblSpriteName.AutoSize = true;
this.lblSpriteName.Location = new System.Drawing.Point(251, 14);
this.lblSpriteName.Location = new System.Drawing.Point(258, 14);
this.lblSpriteName.Name = "lblSpriteName";
this.lblSpriteName.Size = new System.Drawing.Size(86, 17);
this.lblSpriteName.TabIndex = 7;
@ -122,7 +143,7 @@
//
// btnDone
//
this.btnDone.Location = new System.Drawing.Point(434, 259);
this.btnDone.Location = new System.Drawing.Point(421, 309);
this.btnDone.Name = "btnDone";
this.btnDone.Size = new System.Drawing.Size(75, 23);
this.btnDone.TabIndex = 8;
@ -132,7 +153,7 @@
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(353, 259);
this.btnCancel.Location = new System.Drawing.Point(340, 309);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 9;
@ -141,25 +162,25 @@
//
// btnApply
//
this.btnApply.Location = new System.Drawing.Point(434, 230);
this.btnApply.Location = new System.Drawing.Point(340, 280);
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(75, 23);
this.btnApply.TabIndex = 10;
this.btnApply.Text = "Apply";
this.btnApply.UseVisualStyleBackColor = true;
//
// btnNew
// btnNewSprite
//
this.btnNew.Location = new System.Drawing.Point(353, 230);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(75, 23);
this.btnNew.TabIndex = 11;
this.btnNew.Text = "New";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNewSprite.Location = new System.Drawing.Point(238, 280);
this.btnNewSprite.Name = "btnNewSprite";
this.btnNewSprite.Size = new System.Drawing.Size(92, 23);
this.btnNewSprite.TabIndex = 11;
this.btnNewSprite.Text = "New Sprite";
this.btnNewSprite.UseVisualStyleBackColor = true;
//
// tbAmimationSpeed
//
this.tbAmimationSpeed.Location = new System.Drawing.Point(349, 145);
this.tbAmimationSpeed.Location = new System.Drawing.Point(356, 207);
this.tbAmimationSpeed.Name = "tbAmimationSpeed";
this.tbAmimationSpeed.Size = new System.Drawing.Size(100, 22);
this.tbAmimationSpeed.TabIndex = 12;
@ -167,7 +188,7 @@
// lblAnimationSpeed
//
this.lblAnimationSpeed.AutoSize = true;
this.lblAnimationSpeed.Location = new System.Drawing.Point(228, 148);
this.lblAnimationSpeed.Location = new System.Drawing.Point(235, 210);
this.lblAnimationSpeed.Name = "lblAnimationSpeed";
this.lblAnimationSpeed.Size = new System.Drawing.Size(115, 17);
this.lblAnimationSpeed.TabIndex = 13;
@ -176,7 +197,7 @@
// lblDefaultSize
//
this.lblDefaultSize.AutoSize = true;
this.lblDefaultSize.Location = new System.Drawing.Point(261, 188);
this.lblDefaultSize.Location = new System.Drawing.Point(268, 249);
this.lblDefaultSize.Name = "lblDefaultSize";
this.lblDefaultSize.Size = new System.Drawing.Size(84, 17);
this.lblDefaultSize.TabIndex = 14;
@ -184,14 +205,15 @@
//
// tbDefaultSize
//
this.tbDefaultSize.Location = new System.Drawing.Point(349, 185);
this.tbDefaultSize.Location = new System.Drawing.Point(356, 246);
this.tbDefaultSize.Name = "tbDefaultSize";
this.tbDefaultSize.Size = new System.Drawing.Size(100, 22);
this.tbDefaultSize.TabIndex = 15;
//
// btnBack
//
this.btnBack.Location = new System.Drawing.Point(43, 269);
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnBack.Location = new System.Drawing.Point(49, 322);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(29, 23);
this.btnBack.TabIndex = 16;
@ -200,7 +222,8 @@
//
// btnFwd
//
this.btnFwd.Location = new System.Drawing.Point(125, 269);
this.btnFwd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnFwd.Location = new System.Drawing.Point(131, 322);
this.btnFwd.Name = "btnFwd";
this.btnFwd.Size = new System.Drawing.Size(29, 23);
this.btnFwd.TabIndex = 17;
@ -209,20 +232,189 @@
//
// lblCountSprites
//
this.lblCountSprites.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblCountSprites.AutoSize = true;
this.lblCountSprites.Location = new System.Drawing.Point(89, 272);
this.lblCountSprites.Location = new System.Drawing.Point(95, 325);
this.lblCountSprites.Name = "lblCountSprites";
this.lblCountSprites.Size = new System.Drawing.Size(16, 17);
this.lblCountSprites.TabIndex = 18;
this.lblCountSprites.Text = "0";
//
// tpRotateMirror
//
this.tpRotateMirror.Controls.Add(this.tabPage1);
this.tpRotateMirror.Controls.Add(this.tabPage2);
this.tpRotateMirror.Location = new System.Drawing.Point(224, 58);
this.tpRotateMirror.Name = "tpRotateMirror";
this.tpRotateMirror.SelectedIndex = 0;
this.tpRotateMirror.Size = new System.Drawing.Size(282, 143);
this.tpRotateMirror.TabIndex = 19;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.cbStartingImage);
this.tabPage1.Controls.Add(this.lblStartingImage);
this.tabPage1.Controls.Add(this.lblChosenArea);
this.tabPage1.Controls.Add(this.tbNumFrames);
this.tabPage1.Controls.Add(this.lblFrames);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(274, 114);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "tpFromImage";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.cbMirrorH);
this.tabPage2.Controls.Add(this.cbMirrorV);
this.tabPage2.Controls.Add(this.lblRotationDegrees);
this.tabPage2.Controls.Add(this.tbRotation);
this.tabPage2.Controls.Add(this.lblWhichAnim);
this.tabPage2.Controls.Add(this.cbAnimation);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(274, 114);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// panel1
//
this.panel1.Controls.Add(this.rbMirror);
this.panel1.Controls.Add(this.rbRotation);
this.panel1.Controls.Add(this.rbFromImage);
this.panel1.Location = new System.Drawing.Point(224, 31);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(277, 27);
this.panel1.TabIndex = 20;
//
// rbFromImage
//
this.rbFromImage.AutoSize = true;
this.rbFromImage.Location = new System.Drawing.Point(14, 3);
this.rbFromImage.Name = "rbFromImage";
this.rbFromImage.Size = new System.Drawing.Size(103, 21);
this.rbFromImage.TabIndex = 0;
this.rbFromImage.TabStop = true;
this.rbFromImage.Text = "From Image";
this.rbFromImage.UseVisualStyleBackColor = true;
//
// rbRotation
//
this.rbRotation.AutoSize = true;
this.rbRotation.Location = new System.Drawing.Point(120, 3);
this.rbRotation.Name = "rbRotation";
this.rbRotation.Size = new System.Drawing.Size(71, 21);
this.rbRotation.TabIndex = 1;
this.rbRotation.TabStop = true;
this.rbRotation.Text = "Rotate";
this.rbRotation.UseVisualStyleBackColor = true;
//
// rbMirror
//
this.rbMirror.AutoSize = true;
this.rbMirror.Location = new System.Drawing.Point(197, 3);
this.rbMirror.Name = "rbMirror";
this.rbMirror.Size = new System.Drawing.Size(66, 21);
this.rbMirror.TabIndex = 2;
this.rbMirror.TabStop = true;
this.rbMirror.Text = "Mirror";
this.rbMirror.UseVisualStyleBackColor = true;
//
// btnNewAnimation
//
this.btnNewAnimation.Location = new System.Drawing.Point(238, 309);
this.btnNewAnimation.Name = "btnNewAnimation";
this.btnNewAnimation.Size = new System.Drawing.Size(92, 23);
this.btnNewAnimation.TabIndex = 21;
this.btnNewAnimation.Text = "New Anim";
this.btnNewAnimation.UseVisualStyleBackColor = true;
//
// pbPreview
//
this.pbPreview.Location = new System.Drawing.Point(512, 31);
this.pbPreview.Name = "pbPreview";
this.pbPreview.Size = new System.Drawing.Size(91, 77);
this.pbPreview.TabIndex = 22;
this.pbPreview.TabStop = false;
//
// btnPreview
//
this.btnPreview.Location = new System.Drawing.Point(527, 114);
this.btnPreview.Name = "btnPreview";
this.btnPreview.Size = new System.Drawing.Size(75, 23);
this.btnPreview.TabIndex = 23;
this.btnPreview.Text = "Preview";
this.btnPreview.UseVisualStyleBackColor = true;
//
// cbAnimation
//
this.cbAnimation.FormattingEnabled = true;
this.cbAnimation.Location = new System.Drawing.Point(128, 18);
this.cbAnimation.Name = "cbAnimation";
this.cbAnimation.Size = new System.Drawing.Size(100, 24);
this.cbAnimation.TabIndex = 0;
//
// lblWhichAnim
//
this.lblWhichAnim.AutoSize = true;
this.lblWhichAnim.Location = new System.Drawing.Point(38, 8);
this.lblWhichAnim.Name = "lblWhichAnim";
this.lblWhichAnim.Size = new System.Drawing.Size(78, 34);
this.lblWhichAnim.TabIndex = 1;
this.lblWhichAnim.Text = "Based Off\r\nAnimation#";
//
// tbRotation
//
this.tbRotation.Location = new System.Drawing.Point(128, 58);
this.tbRotation.Name = "tbRotation";
this.tbRotation.Size = new System.Drawing.Size(100, 22);
this.tbRotation.TabIndex = 2;
//
// lblRotationDegrees
//
this.lblRotationDegrees.AutoSize = true;
this.lblRotationDegrees.Location = new System.Drawing.Point(54, 61);
this.lblRotationDegrees.Name = "lblRotationDegrees";
this.lblRotationDegrees.Size = new System.Drawing.Size(62, 17);
this.lblRotationDegrees.TabIndex = 3;
this.lblRotationDegrees.Text = "Degrees";
//
// cbMirrorV
//
this.cbMirrorV.AutoSize = true;
this.cbMirrorV.Location = new System.Drawing.Point(148, 87);
this.cbMirrorV.Name = "cbMirrorV";
this.cbMirrorV.Size = new System.Drawing.Size(80, 21);
this.cbMirrorV.TabIndex = 4;
this.cbMirrorV.Text = "Mirror V";
this.cbMirrorV.UseVisualStyleBackColor = true;
//
// cbMirrorH
//
this.cbMirrorH.AutoSize = true;
this.cbMirrorH.Location = new System.Drawing.Point(35, 87);
this.cbMirrorH.Name = "cbMirrorH";
this.cbMirrorH.Size = new System.Drawing.Size(81, 21);
this.cbMirrorH.TabIndex = 5;
this.cbMirrorH.Text = "Mirror H";
this.cbMirrorH.UseVisualStyleBackColor = true;
//
// SpriteEntryForm
//
this.AcceptButton = this.btnApply;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(524, 294);
this.ClientSize = new System.Drawing.Size(614, 347);
this.Controls.Add(this.btnPreview);
this.Controls.Add(this.pbPreview);
this.Controls.Add(this.btnNewAnimation);
this.Controls.Add(this.panel1);
this.Controls.Add(this.tpRotateMirror);
this.Controls.Add(this.lblCountSprites);
this.Controls.Add(this.btnFwd);
this.Controls.Add(this.btnBack);
@ -230,17 +422,12 @@
this.Controls.Add(this.lblDefaultSize);
this.Controls.Add(this.lblAnimationSpeed);
this.Controls.Add(this.tbAmimationSpeed);
this.Controls.Add(this.btnNew);
this.Controls.Add(this.btnNewSprite);
this.Controls.Add(this.btnApply);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnDone);
this.Controls.Add(this.lblSpriteName);
this.Controls.Add(this.tbSpriteName);
this.Controls.Add(this.lblFrames);
this.Controls.Add(this.tbNumFrames);
this.Controls.Add(this.lblChosenArea);
this.Controls.Add(this.lblStartingImage);
this.Controls.Add(this.cbStartingImage);
this.Controls.Add(this.pbImageField);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MaximizeBox = false;
@ -249,6 +436,14 @@
this.Text = "SpriteEntryForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SpriteEntryForm_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.pbImageField)).EndInit();
this.tpRotateMirror.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbPreview)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -267,7 +462,7 @@
private System.Windows.Forms.Button btnDone;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Button btnNew;
private System.Windows.Forms.Button btnNewSprite;
private System.Windows.Forms.TextBox tbAmimationSpeed;
private System.Windows.Forms.Label lblAnimationSpeed;
private System.Windows.Forms.Label lblDefaultSize;
@ -275,5 +470,21 @@
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnFwd;
private System.Windows.Forms.Label lblCountSprites;
private System.Windows.Forms.TabControl tpRotateMirror;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.RadioButton rbMirror;
private System.Windows.Forms.RadioButton rbRotation;
private System.Windows.Forms.RadioButton rbFromImage;
private System.Windows.Forms.Button btnNewAnimation;
private System.Windows.Forms.PictureBox pbPreview;
private System.Windows.Forms.Button btnPreview;
private System.Windows.Forms.CheckBox cbMirrorH;
private System.Windows.Forms.CheckBox cbMirrorV;
private System.Windows.Forms.Label lblRotationDegrees;
private System.Windows.Forms.TextBox tbRotation;
private System.Windows.Forms.Label lblWhichAnim;
private System.Windows.Forms.ComboBox cbAnimation;
}
}

View File

@ -21,6 +21,7 @@ namespace SpriteLibrary
SpriteController MyController;
ResourceManager myResources = null;
List<SpriteInfo> SpriteInformation = new List<SpriteInfo>();
SpriteInfo TempInformation = null;
Size SnapGridSize = new Size(5,5);
SpriteDatabase myDatabase = null;
int CurrentSIIndex = -1; //The information item we are editing. -1 means it is a new one.
@ -40,6 +41,7 @@ namespace SpriteLibrary
{
pbImageField.BackgroundImageLayout = ImageLayout.Stretch;
MyController = new SpriteController(pbImageField);
UpdateMenu();
PopulateMenu();
}
@ -72,6 +74,27 @@ namespace SpriteLibrary
cbStartingImage.SelectedIndex = 0;
}
private void UpdateMenu()
{
lblCountSprites.Text = SpriteInformation.Count.ToString();
if (TempInformation == null) SetUpEmptyInfo();
}
private void SetUpEmptyInfo()
{
TempInformation = new SpriteInfo();
TempInformation.SpriteName = "";
TempInformation.ViewPercent = 100;
AnimationInfo AI = new AnimationInfo();
AI.AnimSpeed = 200;
AI.FieldsToUse = AnimationType.SpriteDefinition;
AI.Height = 100;
AI.Width = 100;
AI.StartPoint = new Point(0, 0);
AI.ViewPercent = 100;
TempInformation.Animations.Add(AI);
}
private void cbStartingImage_SelectedIndexChanged(object sender, EventArgs e)
{
ResourceManager rm;