Skip to content

Commit 1143da9

Browse files
chore: making path works
1 parent 374b4e0 commit 1143da9

9 files changed

Lines changed: 546 additions & 558 deletions

File tree

FreeFrame/Components/Shapes/Path/DrawAttribute.cs

Lines changed: 203 additions & 229 deletions
Large diffs are not rendered by default.

FreeFrame/Components/Shapes/SVGCircle.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public override List<Vector2i> GetSelectablePoints()
4444
throw new NotImplementedException();
4545
}
4646

47-
public override void UpdateProperties(DefaultProperties properties)
48-
{
49-
throw new NotImplementedException();
50-
}
51-
5247
public override void ImplementObject()
5348
{
5449
throw new NotImplementedException();

FreeFrame/Components/Shapes/SVGLine.cs

Lines changed: 14 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ internal class SVGLine : Shape
1919
#endregion
2020

2121
#region Geometry properties
22-
private int _x1;
23-
private int _y1;
24-
private int _x2;
25-
private int _y2;
26-
27-
public int X1 { get => _x1; set => _x1 = value; }
28-
public int Y1 { get => _y1; set => _y1 = value; }
29-
public int X2 { get => _x2; set => _x2 = value; }
30-
public int Y2 { get => _y2; set => _y2 = value; }
3122
#endregion
3223

3324
public SVGLine(XmlReader reader) : this(
@@ -40,60 +31,40 @@ public SVGLine(XmlReader reader) : this(
4031
public SVGLine() : this(DefaultX1, DefaultY1, DefaultX2, DefaultY2) { }
4132
public SVGLine(int x1, int y1, int x2, int y2)
4233
{
43-
X1 = x1;
44-
Y1 = y1;
45-
X2 = x2;
46-
Y2 = y2;
47-
48-
Properties = new DefaultProperties()
49-
{
50-
x = X1,
51-
y = Y1,
52-
width = X2 - X1,
53-
height = Y2 - Y1,
54-
color = Properties.color
55-
};
34+
X = x1;
35+
Y = y1;
36+
Width = x2 - X;
37+
Height = y2 - Y;
5638

5739
ImplementObject();
5840
}
59-
public override float[] GetVertices() => new float[] { X1, Y1, X2, Y2 }; // x, y, x, y, x, y, ... (clockwise)
41+
public override float[] GetVertices() => new float[] { X, Y, Width + X, Height + Y }; // x, y, x, y, x, y, ... (clockwise)
6042
public override uint[] GetVerticesIndexes() => new uint[] { 0, 1 }; // TODO: please dont hardcode
6143

6244
public override void Draw(Vector2i clientSize)
6345
{
6446
foreach (VertexArrayObject vao in _vaos)
65-
vao.Draw(clientSize, Properties.color); // Because that color doesnt depend of the shape TODO: Make it dependend
47+
vao.Draw(clientSize, Color); // Because that color doesnt depend of the shape TODO: Make it dependend
6648
}
67-
public override string ToString() => $"x1: {X1}, y1: {Y1}, x2: {X2}, y2: {Y2}";
49+
public override string ToString() => $"x1: {X}, y1: {Y}, x2: {Width + X}, y2: {Height + Y}";
6850

6951
public override Hitbox Hitbox()
7052
{
7153
Hitbox hitbox = new Hitbox();
7254

73-
hitbox.Areas.Add(new Hitbox.Area(X1, Y1, X2, Y2));
55+
//hitbox.Areas.Add(new Hitbox.Area(X, Y, X2, Y2));
7456

7557
return hitbox;
7658
}
7759

7860
public override List<Vector2i> GetSelectablePoints()
7961
{
8062
List<Vector2i> points = new();
81-
points.Add(new Vector2i(X1, Y1));
82-
points.Add(new Vector2i(X2, Y2));
63+
points.Add(new Vector2i(X, Y));
64+
points.Add(new Vector2i(Width + X, Height + Y));
8365
return points;
8466
}
8567

86-
public override void UpdateProperties(DefaultProperties properties)
87-
{
88-
X1 = Properties.x;
89-
Y1 = Properties.y;
90-
X2 = X1 + Properties.width;
91-
Y2 = Y1 + Properties.height;
92-
93-
Properties = properties;
94-
95-
ImplementObject();
96-
}
9768

9869
public override void ImplementObject()
9970
{
@@ -106,41 +77,16 @@ public override void ImplementObject()
10677

10778
public override void Move(Vector2i position)
10879
{
109-
int width = X2 - X1;
110-
int height = Y2 - Y1;
111-
112-
X1 = position.X;
113-
Y1 = position.Y;
114-
115-
X2 = position.X + width;
116-
Y2 = position.Y + height;
117-
118-
119-
Properties = new DefaultProperties()
120-
{
121-
x = X1,
122-
y = Y1,
123-
width = width,
124-
height = height,
125-
color = Properties.color
126-
};
80+
X = position.X;
81+
Y = position.Y;
12782

12883
ImplementObject();
12984
}
13085

13186
public override void Resize(Vector2i size)
13287
{
133-
X2 = X1 + size.X;
134-
Y2 = Y1 + size.Y;
135-
136-
Properties = new DefaultProperties()
137-
{
138-
x = X1,
139-
y = Y1,
140-
width = X2 - X1,
141-
height = Y2 - Y1,
142-
color = Properties.color
143-
};
88+
Width = size.X;
89+
Height = size.Y;
14490

14591
ImplementObject();
14692
}

0 commit comments

Comments
 (0)