Skip to content

Commit b43de41

Browse files
Merge pull request #17 from JeremyMeissner/2-edit-element-properties
Edit elements properties
2 parents 0d86fee + 14ac317 commit b43de41

18 files changed

Lines changed: 1829 additions & 260 deletions

FreeFrame/Components/Importer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ static public (List<Shape>, bool) ImportFromStream(Stream pStream)
3939
case "circle":
4040
shapes.Add(new SVGCircle(reader));
4141
break;
42+
case "line":
43+
shapes.Add(new SVGLine(reader));
44+
break;
4245
default:
4346
compatibilityFlag = true; // If an element is unknow, the flag is trigger
4447
break;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace FreeFrame.Components.Shapes
8+
{
9+
10+
public class Hitbox
11+
{
12+
// TODO: Absolute or relative ?
13+
public struct Area
14+
{
15+
public int X;
16+
public int Y;
17+
public int Width;
18+
public int Height;
19+
public Area(int x, int y, int width, int height)
20+
{
21+
X = x;
22+
Y = y;
23+
Width = width;
24+
Height = height;
25+
}
26+
}
27+
List<Area> _areas = new List<Area>();
28+
29+
public List<Area> Areas { get => _areas; set => _areas = value; }
30+
31+
public Hitbox()
32+
{
33+
}
34+
35+
public bool IsThereSomething(float x, float y) // mouse position
36+
{
37+
foreach (Area area in Areas)
38+
if (x >= area.X && x <= area.X+area.Width && y >= area.Y && y <= area.Y+area.Height) // TODO: To check if it's working
39+
return true;
40+
return false;
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)