Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneWandererProductions committed Dec 31, 2023
1 parent ba80262 commit d5d5ed0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Aurorae/Aurora.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ public List<int> DependencyMovement
SetValue(Movement, value);

//display an movement Animation, block the whole control while displaying
IsEnabled = false;
LayerThree.Source = Helper.DisplayMovement(this, value, DependencyAvatar, DependencyWidth, DependencyHeight, DependencyTextureSize);
IsEnabled = true;
Helper.DisplayMovement(this, value, DependencyAvatar, DependencyWidth, DependencyHeight, DependencyTextureSize);
}
}

Expand Down
17 changes: 14 additions & 3 deletions Aurorae/Helper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
Expand Down Expand Up @@ -110,21 +112,30 @@ internal static ImageSource GenerateNumbers(int width, int height, int textureSi
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="textureSize">Size of the texture.</param>
/// <returns></returns>
internal static ImageSource DisplayMovement(Aurora aurora, List<int> steps, Image avatar,
internal static async void DisplayMovement(Aurora aurora, List<int> steps, Image avatar,
int width,
int height,
int textureSize)
{
aurora.IsEnabled = false;

var background = new Bitmap(width * textureSize, height * textureSize);

foreach (var step in steps)
{
var x = IdToX(step, width);
var y = IdToY(step, width);

await Task.Run(SwitchPosition);
}

return background.ToBitmapImage();
aurora.IsEnabled = true;
aurora.LayerThree.Source = background.ToBitmapImage();
}

private static void SwitchPosition()
{
Thread.Sleep(1000);
}

/// <summary>
Expand Down

0 comments on commit d5d5ed0

Please sign in to comment.