Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FreeFrame/Components/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ static public (List<Shape>, bool) ImportFromStream(Stream pStream)
case "circle":
shapes.Add(new SVGCircle(reader));
break;
case "line":
shapes.Add(new SVGLine(reader));
break;
default:
compatibilityFlag = true; // If an element is unknow, the flag is trigger
break;
Expand Down
43 changes: 43 additions & 0 deletions FreeFrame/Components/Shapes/Hitbox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FreeFrame.Components.Shapes
{

public class Hitbox
{
// TODO: Absolute or relative ?
public struct Area
{
public int X;
public int Y;
public int Width;
public int Height;
public Area(int x, int y, int width, int height)
{
X = x;
Y = y;
Width = width;
Height = height;
}
}
List<Area> _areas = new List<Area>();

public List<Area> Areas { get => _areas; set => _areas = value; }

public Hitbox()
{
}

public bool IsThereSomething(float x, float y) // mouse position
{
foreach (Area area in Areas)
if (x >= area.X && x <= area.X+area.Width && y >= area.Y && y <= area.Y+area.Height) // TODO: To check if it's working
return true;
return false;
}
}
}
Loading