-
Notifications
You must be signed in to change notification settings - Fork 0
/
DrawParameters.cs
171 lines (128 loc) · 4.69 KB
/
DrawParameters.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
//using System.Numerics;
//namespace BasicGraphicsEngine
//{
// public partial class Drawer
// {
// // Declaration //
// BasicCircle[] Blues = new BasicCircle[500];
// BasicCircle[] Reds = new BasicCircle[500];
// Vector2[] Blue_Vel = new Vector2[500];
// Vector2[] Red_Vel = new Vector2[500];
// // //
// public void SetUp()
// {
// PointF BlueStart = new PointF(DisplayCentre.Y, (DisplayCentre.X + DisplayCentre.X /4));
// for (int i = 0; i < Blue_Vel.Count(); i++)
// {
// Blue_Vel[i] = new Vector2
// (
// RandomValue(-20, 20, false),
// RandomValue(-20, 20, false)
// );
// Blues[i] = new BasicCircle(BlueStart.ToVector2(), 10);
// Blues[i].PrimaryCol = Color.Blue;
// Blues[i].SecondaryCol = Color.Green;
// }
// CanvasColour = Color.Beige;
// DisplayEvent += Resize;
// AddShapes(Blues);
// AddShapes(Reds);
// }
// private void Resize(object Sender, DisplayEventArgs De)
// {
// }
// private void GraphicsFrame()
// {
// //for (int i = 0; i < CircleArray.Count(); i++)
// //{
// // if (i < CircleArray.Count() - 1)
// // {
// // LineArray[i].A = CircleArray[i].Centre;
// // LineArray[i].B = CircleArray[i + 1].Centre;
// // }
// //
// // CircleArray[i].Centre += BC_Vel[i];
// //
// // if
// // ((CircleArray[i].Centre.X + (CircleArray[i].Width / 2)) >= DisplaySize.X ||
// // (CircleArray[i].Centre.X - (CircleArray[i].Width / 2)) <= 0)
// // { BC_Vel[i].X *= -1; }
// //
// // if
// // ((CircleArray[i].Centre.Y + (CircleArray[i].Height / 2)) >= DisplaySize.Y ||
// // (CircleArray[i].Centre.Y - (CircleArray[i].Height / 2)) <= 0)
// // { BC_Vel[i].Y *= -1; }
// //}
// }
// }
//}
using System.Numerics;
using BasicGraphicsEngine.Back.Utilities;
namespace BasicGraphicsEngine
{
public partial class Drawer
{
// Declaration //
BasicCircle[] CircleArray = new BasicCircle[100000];
//Line[] LineArray = new Line[100000];
Vector2[] BC_Vel = new Vector2[100000];
// //
public void SetUp()
{
for (int i = 0; i < BC_Vel.Count(); i++)
{
BC_Vel[i] = new Vector2
(
Maths.RandomValue(-20, 20, false),
Maths.RandomValue(-20, 20, false)
);
//LineArray[i] = new Line();
//
//LineArray[i].PrimaryCol = Color.DeepPink;
//
//LineArray[i].LineWidth = 1f;
CircleArray[i] = new BasicCircle(DisplayCentre, 10);
CircleArray[i].PrimaryCol = Color.Blue;
CircleArray[i].SecondaryCol = Color.Green;
}
CanvasColour = Color.Beige;
DisplayEvent += Resize;
//AddShape(LineArray);
AddShape(CircleArray);
}
private void Resize(object Sender, DisplayEventArgs De)
{
for (int i = 0; i < CircleArray.Count(); i++)
{ CircleArray[i].Centre = DisplayCentre; }
}
/// <summary>
/// Triggers 60 times a sec
/// </summary>
private void PhysicsFrame()
{
for (int i = 0; i < CircleArray.Count(); i++)
{
//if (i < CircleArray.Count() - 1)
//{
// LineArray[i].A = CircleArray[i].Centre;
// LineArray[i].B = CircleArray[i + 1].Centre;
//}
CircleArray[i].Centre += BC_Vel[i];
if
((CircleArray[i].Centre.X + (CircleArray[i].Width / 2)) >= DisplaySize.X ||
(CircleArray[i].Centre.X - (CircleArray[i].Width / 2)) <= 0)
{ BC_Vel[i].X *= -1; }
if
((CircleArray[i].Centre.Y + (CircleArray[i].Height / 2)) >= DisplaySize.Y ||
(CircleArray[i].Centre.Y - (CircleArray[i].Height / 2)) <= 0)
{ BC_Vel[i].Y *= -1; }
}
}
/// <summary>
/// Triggers x times a second, depends on target framerate
/// </summary>
private void GraphicsFrame()
{
}
}
}