Changed: Separated Panning and Dragging functions. Added: Frame duplication, FrameSprite replacement

This commit is contained in:
quinnvoker
2018-12-22 15:45:38 -08:00
parent 9e4c8732c3
commit 1a21b230ad
3 changed files with 184 additions and 119 deletions
+79 -62
View File
@@ -100,6 +100,7 @@ namespace AnimationEditor
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)
{ {
base.Update(gameTime); base.Update(gameTime);
MouseControl();
if (Playing && PreviewSprite != null) if (Playing && PreviewSprite != null)
{ {
@@ -113,16 +114,35 @@ namespace AnimationEditor
OnFrameChanged(new EventArgs()); OnFrameChanged(new EventArgs());
} }
} }
else if(PreviewSprite != null)
{
MouseControl();
}
} }
private void MouseControl() private void MouseControl()
{ {
mState = Mouse.GetState(); mState = Mouse.GetState();
if(EditSprite != null)
//fix for when detecting the mouse being within Bounds made an uninteractable section appear at the top of screen and allowed interaction below bottom
Rectangle frame = new Rectangle(Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height);
frame.Y = 0;
if (frame.Contains(mState.X, mState.Y))
{
HandleDragging();
HandlePanning();
}
else
{
if (hovering)
Cursor = System.Windows.Forms.Cursors.Default;
hovering = false;
dragging = false;
}
mState_old = mState;
}
private void HandleDragging()
{
if (EditSprite != null)
{ {
/*create draggable rect spriteRect at 0,0 /*create draggable rect spriteRect at 0,0
*rect is scaled by Zoomlevel to match sprite's onscreen size *rect is scaled by Zoomlevel to match sprite's onscreen size
@@ -137,73 +157,70 @@ namespace AnimationEditor
Rectangle frame = new Rectangle(Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height); Rectangle frame = new Rectangle(Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height);
frame.Y = 0; frame.Y = 0;
if (frame.Contains(mState.X, mState.Y)) if (spriteRect.Contains(mState.Position))
{ {
if (spriteRect.Contains(mState.Position)) if (!hovering)
{ {
if (!hovering) Cursor = System.Windows.Forms.Cursors.SizeAll;
{ hovering = true;
Cursor = System.Windows.Forms.Cursors.SizeAll;
hovering = true;
}
}
else
{
if (hovering && !dragging)
{
Cursor = System.Windows.Forms.Cursors.Default;
hovering = false;
}
}
if (mState.LeftButton == ButtonState.Pressed && mState_old.LeftButton != ButtonState.Pressed)
dragging = hovering;
else if (mState.RightButton == ButtonState.Pressed && mState_old.RightButton != ButtonState.Pressed)
panning = true;
if (mState.LeftButton != ButtonState.Pressed)
dragging = false;
if (mState.RightButton != ButtonState.Pressed)
{
//if the camera has been panned, lock the camera position to integers to prevent ugly misaligned sprites
if (panning)
CameraLocation = new Vector3((int)CameraLocation.X, (int)CameraLocation.Y, (int)CameraLocation.Z);
panning = false;
}
if (dragging)
{
var mousePosScaled = (mState.Position.ToVector2() / ZoomLevel).ToPoint();
var mousePosOldScaled = (mState_old.Position.ToVector2() / ZoomLevel).ToPoint();
Vector2 distMoved = new Vector2(mousePosScaled.X - mousePosOldScaled.X, mousePosScaled.Y - mousePosOldScaled.Y);
if (distMoved != Vector2.Zero)
{
EditSprite.Offset += distMoved;
OnSpriteMoved(new EventArgs());
}
}
if (panning)
{
Vector3 distMoved = new Vector3(mState.X - mState_old.X, mState.Y - mState_old.Y, 0);
if (distMoved != Vector3.Zero)
{
CameraLocation += distMoved / ZoomLevel;
}
} }
} }
else else
{ {
if (hovering) if (hovering && !dragging)
{
Cursor = System.Windows.Forms.Cursors.Default; Cursor = System.Windows.Forms.Cursors.Default;
hovering = false; hovering = false;
}
}
if (mState.LeftButton == ButtonState.Pressed && mState.RightButton != ButtonState.Pressed && mState_old.LeftButton != ButtonState.Pressed)
dragging = hovering;
if (mState.LeftButton != ButtonState.Pressed)
dragging = false; dragging = false;
if (dragging)
{
var mousePosScaled = (mState.Position.ToVector2() / ZoomLevel).ToPoint();
var mousePosOldScaled = (mState_old.Position.ToVector2() / ZoomLevel).ToPoint();
Vector2 distMoved = new Vector2(mousePosScaled.X - mousePosOldScaled.X, mousePosScaled.Y - mousePosOldScaled.Y);
if (distMoved != Vector2.Zero)
{
EditSprite.Offset += distMoved;
OnSpriteMoved(new EventArgs());
}
}
}
}
private void HandlePanning()
{
if (Enabled)
{
if (mState.RightButton == ButtonState.Pressed && mState.LeftButton != ButtonState.Pressed && mState_old.RightButton != ButtonState.Pressed)
panning = true;
if (mState.RightButton != ButtonState.Pressed)
{
//if the camera has been panned, lock the camera position to integers to prevent ugly misaligned sprites
if (panning)
CameraLocation = new Vector3((int)CameraLocation.X, (int)CameraLocation.Y, (int)CameraLocation.Z);
panning = false;
}
if (panning)
{
Vector3 distMoved = new Vector3(mState.X - mState_old.X, mState.Y - mState_old.Y, 0);
if (distMoved != Vector3.Zero)
{
CameraLocation += distMoved / ZoomLevel;
}
} }
} }
mState_old = mState;
} }
protected virtual void OnSpriteMoved(EventArgs e) protected virtual void OnSpriteMoved(EventArgs e)
+88 -57
View File
@@ -61,7 +61,11 @@
this.addAnimationButton = new System.Windows.Forms.Button(); this.addAnimationButton = new System.Windows.Forms.Button();
this.removeAnimationButton = new System.Windows.Forms.Button(); this.removeAnimationButton = new System.Windows.Forms.Button();
this.frameEditorPanel = new System.Windows.Forms.Panel(); this.frameEditorPanel = new System.Windows.Forms.Panel();
this.frameNameBox = new System.Windows.Forms.TextBox();
this.frameSpritePanel = new System.Windows.Forms.Panel(); this.frameSpritePanel = new System.Windows.Forms.Panel();
this.removeSpriteButton = new System.Windows.Forms.Button();
this.moveSpriteUpButton = new System.Windows.Forms.Button();
this.moveSpriteDownButton = new System.Windows.Forms.Button();
this.frameSpritePositionLabel = new System.Windows.Forms.Label(); this.frameSpritePositionLabel = new System.Windows.Forms.Label();
this.frameSpriteListBox = new System.Windows.Forms.ListBox(); this.frameSpriteListBox = new System.Windows.Forms.ListBox();
this.spriteYPosLabel = new System.Windows.Forms.Label(); this.spriteYPosLabel = new System.Windows.Forms.Label();
@@ -73,6 +77,7 @@
this.importDelayLabel = new System.Windows.Forms.Label(); this.importDelayLabel = new System.Windows.Forms.Label();
this.importValuesLabel = new System.Windows.Forms.Label(); this.importValuesLabel = new System.Windows.Forms.Label();
this.importDelayBox = new System.Windows.Forms.NumericUpDown(); this.importDelayBox = new System.Windows.Forms.NumericUpDown();
this.frameNameLabel = new System.Windows.Forms.Label();
this.delayLabel = new System.Windows.Forms.Label(); this.delayLabel = new System.Windows.Forms.Label();
this.frameInfoLabel = new System.Windows.Forms.Label(); this.frameInfoLabel = new System.Windows.Forms.Label();
this.frameBoxLabel = new System.Windows.Forms.Label(); this.frameBoxLabel = new System.Windows.Forms.Label();
@@ -82,12 +87,9 @@
this.animationNameLabel = new System.Windows.Forms.Label(); this.animationNameLabel = new System.Windows.Forms.Label();
this.animationLabel = new System.Windows.Forms.Label(); this.animationLabel = new System.Windows.Forms.Label();
this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog(); this.loadAnimationSetDialog = new System.Windows.Forms.OpenFileDialog();
this.frameNameBox = new System.Windows.Forms.TextBox(); this.duplicateFrameButton = new System.Windows.Forms.Button();
this.frameNameLabel = new System.Windows.Forms.Label();
this.moveSpriteDownButton = new System.Windows.Forms.Button();
this.moveSpriteUpButton = new System.Windows.Forms.Button();
this.removeSpriteButton = new System.Windows.Forms.Button();
this.animationPreview = new AnimationEditor.AnimationPreview(); this.animationPreview = new AnimationEditor.AnimationPreview();
this.replaceSpriteButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.spritePreview)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.frameTrackBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.delayInputBox)).BeginInit();
@@ -412,6 +414,7 @@
this.frameEditorPanel.Controls.Add(this.moveFrameDownButton); this.frameEditorPanel.Controls.Add(this.moveFrameDownButton);
this.frameEditorPanel.Controls.Add(this.delayInputBox); this.frameEditorPanel.Controls.Add(this.delayInputBox);
this.frameEditorPanel.Controls.Add(this.moveFrameUpButton); this.frameEditorPanel.Controls.Add(this.moveFrameUpButton);
this.frameEditorPanel.Controls.Add(this.duplicateFrameButton);
this.frameEditorPanel.Controls.Add(this.addEmptyFrameButton); this.frameEditorPanel.Controls.Add(this.addEmptyFrameButton);
this.frameEditorPanel.Controls.Add(this.removeFrameButton); this.frameEditorPanel.Controls.Add(this.removeFrameButton);
this.frameEditorPanel.Enabled = false; this.frameEditorPanel.Enabled = false;
@@ -420,6 +423,14 @@
this.frameEditorPanel.Size = new System.Drawing.Size(290, 403); this.frameEditorPanel.Size = new System.Drawing.Size(290, 403);
this.frameEditorPanel.TabIndex = 19; this.frameEditorPanel.TabIndex = 19;
// //
// frameNameBox
//
this.frameNameBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.frameNameBox.Location = new System.Drawing.Point(200, 228);
this.frameNameBox.Name = "frameNameBox";
this.frameNameBox.Size = new System.Drawing.Size(83, 20);
this.frameNameBox.TabIndex = 25;
//
// frameSpritePanel // frameSpritePanel
// //
this.frameSpritePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.frameSpritePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -431,6 +442,7 @@
this.frameSpritePanel.Controls.Add(this.spriteYPosLabel); this.frameSpritePanel.Controls.Add(this.spriteYPosLabel);
this.frameSpritePanel.Controls.Add(this.spriteXPosLabel); this.frameSpritePanel.Controls.Add(this.spriteXPosLabel);
this.frameSpritePanel.Controls.Add(this.frameSpriteListLabel); this.frameSpritePanel.Controls.Add(this.frameSpriteListLabel);
this.frameSpritePanel.Controls.Add(this.replaceSpriteButton);
this.frameSpritePanel.Controls.Add(this.addSpriteToFrameSpritesButton); this.frameSpritePanel.Controls.Add(this.addSpriteToFrameSpritesButton);
this.frameSpritePanel.Controls.Add(this.spriteYPosBox); this.frameSpritePanel.Controls.Add(this.spriteYPosBox);
this.frameSpritePanel.Controls.Add(this.spriteXPosBox); this.frameSpritePanel.Controls.Add(this.spriteXPosBox);
@@ -439,6 +451,42 @@
this.frameSpritePanel.Size = new System.Drawing.Size(161, 126); this.frameSpritePanel.Size = new System.Drawing.Size(161, 126);
this.frameSpritePanel.TabIndex = 24; this.frameSpritePanel.TabIndex = 24;
// //
// removeSpriteButton
//
this.removeSpriteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.removeSpriteButton.Location = new System.Drawing.Point(132, 0);
this.removeSpriteButton.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.removeSpriteButton.Name = "removeSpriteButton";
this.removeSpriteButton.Size = new System.Drawing.Size(23, 23);
this.removeSpriteButton.TabIndex = 26;
this.removeSpriteButton.Text = "X";
this.removeSpriteButton.UseVisualStyleBackColor = true;
this.removeSpriteButton.Click += new System.EventHandler(this.removeSpriteButton_Click);
//
// moveSpriteUpButton
//
this.moveSpriteUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.moveSpriteUpButton.Location = new System.Drawing.Point(109, 0);
this.moveSpriteUpButton.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.moveSpriteUpButton.Name = "moveSpriteUpButton";
this.moveSpriteUpButton.Size = new System.Drawing.Size(23, 23);
this.moveSpriteUpButton.TabIndex = 26;
this.moveSpriteUpButton.Text = "↑";
this.moveSpriteUpButton.UseVisualStyleBackColor = true;
this.moveSpriteUpButton.Click += new System.EventHandler(this.moveSpriteUpButton_Click);
//
// moveSpriteDownButton
//
this.moveSpriteDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.moveSpriteDownButton.Location = new System.Drawing.Point(86, 0);
this.moveSpriteDownButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.moveSpriteDownButton.Name = "moveSpriteDownButton";
this.moveSpriteDownButton.Size = new System.Drawing.Size(23, 23);
this.moveSpriteDownButton.TabIndex = 26;
this.moveSpriteDownButton.Text = "↓";
this.moveSpriteDownButton.UseVisualStyleBackColor = true;
this.moveSpriteDownButton.Click += new System.EventHandler(this.moveSpriteDownButton_Click);
//
// frameSpritePositionLabel // frameSpritePositionLabel
// //
this.frameSpritePositionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.frameSpritePositionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -570,6 +618,16 @@
this.importDelayBox.TabIndex = 19; this.importDelayBox.TabIndex = 19;
this.importDelayBox.ValueChanged += new System.EventHandler(this.importDelayBox_ValueChanged); this.importDelayBox.ValueChanged += new System.EventHandler(this.importDelayBox_ValueChanged);
// //
// frameNameLabel
//
this.frameNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.frameNameLabel.AutoSize = true;
this.frameNameLabel.Location = new System.Drawing.Point(162, 231);
this.frameNameLabel.Name = "frameNameLabel";
this.frameNameLabel.Size = new System.Drawing.Size(35, 13);
this.frameNameLabel.TabIndex = 18;
this.frameNameLabel.Text = "Name";
//
// delayLabel // delayLabel
// //
this.delayLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.delayLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -667,59 +725,15 @@
this.loadAnimationSetDialog.FileName = "openFileDialog1"; this.loadAnimationSetDialog.FileName = "openFileDialog1";
this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet"; this.loadAnimationSetDialog.Filter = "QUROGames AnimationSet|*.animSet";
// //
// frameNameBox // duplicateFrameButton
// //
this.frameNameBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.duplicateFrameButton.Location = new System.Drawing.Point(130, 18);
this.frameNameBox.Location = new System.Drawing.Point(200, 228); this.duplicateFrameButton.Name = "duplicateFrameButton";
this.frameNameBox.Name = "frameNameBox"; this.duplicateFrameButton.Size = new System.Drawing.Size(27, 23);
this.frameNameBox.Size = new System.Drawing.Size(83, 20); this.duplicateFrameButton.TabIndex = 12;
this.frameNameBox.TabIndex = 25; this.duplicateFrameButton.Text = "++";
// this.duplicateFrameButton.UseVisualStyleBackColor = true;
// frameNameLabel this.duplicateFrameButton.Click += new System.EventHandler(this.duplicateFrameButton_Click);
//
this.frameNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.frameNameLabel.AutoSize = true;
this.frameNameLabel.Location = new System.Drawing.Point(162, 231);
this.frameNameLabel.Name = "frameNameLabel";
this.frameNameLabel.Size = new System.Drawing.Size(35, 13);
this.frameNameLabel.TabIndex = 18;
this.frameNameLabel.Text = "Name";
//
// moveSpriteDownButton
//
this.moveSpriteDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.moveSpriteDownButton.Location = new System.Drawing.Point(86, 0);
this.moveSpriteDownButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.moveSpriteDownButton.Name = "moveSpriteDownButton";
this.moveSpriteDownButton.Size = new System.Drawing.Size(23, 23);
this.moveSpriteDownButton.TabIndex = 26;
this.moveSpriteDownButton.Text = "↓";
this.moveSpriteDownButton.UseVisualStyleBackColor = true;
this.moveSpriteDownButton.Click += new System.EventHandler(this.moveSpriteDownButton_Click);
//
// moveSpriteUpButton
//
this.moveSpriteUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.moveSpriteUpButton.Location = new System.Drawing.Point(109, 0);
this.moveSpriteUpButton.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.moveSpriteUpButton.Name = "moveSpriteUpButton";
this.moveSpriteUpButton.Size = new System.Drawing.Size(23, 23);
this.moveSpriteUpButton.TabIndex = 26;
this.moveSpriteUpButton.Text = "↑";
this.moveSpriteUpButton.UseVisualStyleBackColor = true;
this.moveSpriteUpButton.Click += new System.EventHandler(this.moveSpriteUpButton_Click);
//
// removeSpriteButton
//
this.removeSpriteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.removeSpriteButton.Location = new System.Drawing.Point(132, 0);
this.removeSpriteButton.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.removeSpriteButton.Name = "removeSpriteButton";
this.removeSpriteButton.Size = new System.Drawing.Size(23, 23);
this.removeSpriteButton.TabIndex = 26;
this.removeSpriteButton.Text = "X";
this.removeSpriteButton.UseVisualStyleBackColor = true;
this.removeSpriteButton.Click += new System.EventHandler(this.removeSpriteButton_Click);
// //
// animationPreview // animationPreview
// //
@@ -727,8 +741,11 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.animationPreview.BackColor = System.Drawing.SystemColors.ControlDarkDark; this.animationPreview.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.animationPreview.EditSprite = null;
this.animationPreview.GridSpacing = 0;
this.animationPreview.Location = new System.Drawing.Point(3, 26); this.animationPreview.Location = new System.Drawing.Point(3, 26);
this.animationPreview.Name = "animationPreview"; this.animationPreview.Name = "animationPreview";
this.animationPreview.PixelGridDisplayLevel = 0;
this.animationPreview.Playing = false; this.animationPreview.Playing = false;
this.animationPreview.PreviewSprite = null; this.animationPreview.PreviewSprite = null;
this.animationPreview.Size = new System.Drawing.Size(467, 306); this.animationPreview.Size = new System.Drawing.Size(467, 306);
@@ -738,6 +755,18 @@
this.animationPreview.ZoomLevel = 0F; this.animationPreview.ZoomLevel = 0F;
this.animationPreview.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.animationPreview_MouseWheel); this.animationPreview.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.animationPreview_MouseWheel);
// //
// replaceSpriteButton
//
this.replaceSpriteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.replaceSpriteButton.Location = new System.Drawing.Point(1, 56);
this.replaceSpriteButton.Name = "replaceSpriteButton";
this.replaceSpriteButton.Size = new System.Drawing.Size(27, 23);
this.replaceSpriteButton.TabIndex = 5;
this.replaceSpriteButton.Text = "@";
this.replaceSpriteButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.replaceSpriteButton.UseVisualStyleBackColor = true;
this.replaceSpriteButton.Click += new System.EventHandler(this.replaceSpriteButton_Click);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -831,6 +860,8 @@
private System.Windows.Forms.Button removeSpriteButton; private System.Windows.Forms.Button removeSpriteButton;
private System.Windows.Forms.Button moveSpriteUpButton; private System.Windows.Forms.Button moveSpriteUpButton;
private System.Windows.Forms.Button moveSpriteDownButton; private System.Windows.Forms.Button moveSpriteDownButton;
private System.Windows.Forms.Button duplicateFrameButton;
private System.Windows.Forms.Button replaceSpriteButton;
} }
} }
+17
View File
@@ -143,6 +143,7 @@ namespace AnimationEditor
else else
animationPreview.PreviewSprite.CurrentAnimation = currentAnimation; animationPreview.PreviewSprite.CurrentAnimation = currentAnimation;
frameTrackBar.Maximum = currentAnimation.Frames.Count() - 1; frameTrackBar.Maximum = currentAnimation.Frames.Count() - 1;
frameListBox_SetSingleSelection(frameTrackBar.Value);
if(animations.Count < 1) if(animations.Count < 1)
{ {
animations.Add(currentAnimation); animations.Add(currentAnimation);
@@ -643,5 +644,21 @@ namespace AnimationEditor
{ {
ReadSpriteOffset(); ReadSpriteOffset();
} }
private void duplicateFrameButton_Click(object sender, EventArgs e)
{
AddFrame(currentFrame.Clone());
}
private void replaceSpriteButton_Click(object sender, EventArgs e)
{
var spr = frameSprites[frameSpriteListBox.SelectedIndex];
var replacement = spriteSet[spriteListBox.SelectedIndex];
spr.Bounds = replacement.Bounds;
spr.Origin = replacement.Origin;
spr.Name = replacement.Name;
UpdateAnimation();
}
} }
} }