-
Notifications
You must be signed in to change notification settings - Fork 0
/
BasicAnimation.cs
48 lines (38 loc) · 1.35 KB
/
BasicAnimation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using NodeGames.UI.Interfaces;
using Point = NodeGames.Core.Point;
namespace NodeGames.UI.MonoGame
{
public abstract class BasicAnimation : IBasicAnimation<Color>
{
public Point Center { get; }
protected BasicAnimation(Vector2 center)
{
Center = new Point((int) center.X, (int) center.Y);
}
protected BasicAnimation(Microsoft.Xna.Framework.Point center)
{
Center = new Point(center.X, center.Y);
}
protected abstract Texture2D GetCurrentTexture();
public abstract void Update(TimeSpan getElapsedTime);
public void Draw(IPainter<Color> painter, Point location)
{
var currentTexture = GetCurrentTexture();
var texture = new Texture(currentTexture);
painter.Draw(texture, location, Color.White);
}
public void Draw(IPainter<Color> painter, Point location, float scale)
{
var currentTexture = GetCurrentTexture();
var texture = new Texture(currentTexture);
painter.Draw(texture, location, scale, Color.White);
}
}
}