daily update on 20240610 by nitload youmu
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Geometries;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
@@ -35,23 +37,29 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public delegate Image BuildAnimationDelegate(float time, out Polygon4 texutreFrame);
|
||||
|
||||
public sealed class AnimationBuilder: IImageProvider
|
||||
{
|
||||
|
||||
private Image cache;
|
||||
|
||||
private Polygon4 textureFrame;
|
||||
private TimeFunction time;
|
||||
|
||||
public AnimationBuilder(
|
||||
Func<float, Image> builderFunc,
|
||||
BuildAnimationDelegate builderFunc,
|
||||
TimeFunction timeline
|
||||
)
|
||||
{
|
||||
textureFrame = new Polygon4();
|
||||
time = timeline;
|
||||
BuilderFunc = builderFunc;
|
||||
cache = BuilderFunc(time.Calculate(), out textureFrame);
|
||||
}
|
||||
|
||||
public Func<float, Image> BuilderFunc { get; set; }
|
||||
public Polygon4 TextureFrame { get => textureFrame; }
|
||||
|
||||
public BuildAnimationDelegate BuilderFunc { get; set; }
|
||||
|
||||
public bool IsComplete
|
||||
{
|
||||
@@ -62,7 +70,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
if (!time.IsComplete)
|
||||
{
|
||||
cache = BuilderFunc(time.Calculate());
|
||||
cache = BuilderFunc(time.Calculate(),out textureFrame);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user