-
Notifications
You must be signed in to change notification settings - Fork 0
/
Circle.cs
69 lines (59 loc) · 1.69 KB
/
Circle.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using SFML.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Presentation
{
class Circle : CircleShape, Drawable, IMoveable
{
public int number { get; set; }
Font f;
Text t;
public Circle(int number)
{
f = new Font(Environment.GetFolderPath(Environment.SpecialFolder.Fonts) + "\\arial.ttf");
t = new Text(number.ToString(), f, 30);
t.Color = Color.Black;
}
public Circle(float r, uint pointCount, int number) : this(number)
{
this.number = number;
Radius = r;
SetPointCount(pointCount);
t.Origin = new SFML.System.Vector2f(-r + t.GetLocalBounds().Width / 2 + t.GetLocalBounds().Left, -r + t.GetLocalBounds().Height / 2 + t.GetLocalBounds().Top);
}
public new void Draw(RenderTarget target, RenderStates states)
{
base.Draw(target, states);
target.Draw(t);
}
public new SFML.System.Vector2f Origin
{
get { return base.Origin; }
set
{
base.Origin = value;
t.Origin += value;
}
}
public new SFML.System.Vector2f Position
{
get { return base.Position; }
set
{
base.Position = value;
t.Position = value;
}
}
public void OnEClicked()
{
this.FillColor = Color.Green;
}
public void OnQClicked()
{
this.FillColor = Color.Blue;
}
}
}