Merge branch 'main' into 3dSkinRenderer

This commit is contained in:
miku-666
2024-07-07 13:54:51 +02:00
4 changed files with 6 additions and 12 deletions

View File

@@ -20,10 +20,10 @@ namespace PckStudio.Extensions
return null;
}
var ms = new System.IO.MemoryStream();
var generateor = new AnimatedGifCreator(ms, Animation.GameTickInMilliseconds, 0);
var generateor = new AnimatedGifCreator(ms, GameConstants.GameTickInMilliseconds, 0);
foreach (var frame in animation.GetInterpolatedFrames())
{
generateor.AddFrame(frame.Texture, frame.Ticks * Animation.GameTickInMilliseconds, GifQuality.Bit8);
generateor.AddFrame(frame.Texture, frame.Ticks * GameConstants.GameTickInMilliseconds, GifQuality.Bit8);
}
ms.Position = 0;
return Image.FromStream(ms);

View File

@@ -465,14 +465,7 @@ namespace PckStudio.Forms.Editor
};
if (fileDialog.ShowDialog(this) != DialogResult.OK)
return;
using (var gifWriter = AnimatedGif.AnimatedGif.Create(fileDialog.FileName, Animation.GameTickInMilliseconds, repeat: 0))
{
foreach (var frame in _animation.GetInterpolatedFrames())
{
gifWriter.AddFrame(frame.Texture, frame.Ticks * Animation.GameTickInMilliseconds, GifQuality.Bit8);
}
}
_animation.CreateAnimationImage().Save(fileDialog.FileName);
}
private void frameTimeandTicksToolStripMenuItem_Click(object sender, EventArgs e)

View File

@@ -29,8 +29,6 @@ namespace PckStudio.Internal
{
public const int MinimumFrameTime = 1;
public const int GameTickInMilliseconds = 50;
public int FrameCount => frames.Count;
public int TextureCount => textures.Count;

View File

@@ -9,6 +9,9 @@ namespace PckStudio.Internal
{
internal static class GameConstants
{
public const int GameTickInMilliseconds = 50;
// See: https://minecraft.fandom.com/wiki/Dye#Color_values for more information.
public static readonly Color[] DyeColors = [
Color.FromArgb(0xf9fffe), // White