public void BeginPath(float x, float y) { if (buildingPath) { // delete old path if it hasn't ended points.Count = currentPath.pointRange.start; holes.Count = currentPath.holeRange.start; } currentPath = new PathDef(); currentPath.pointRange.start = points.Count; currentPath.holeRange.start = holes.Count; currentPath.pointRange.length++; points.Add(new PathPoint(x, y, PointFlag.Corner)); buildingPath = true; inHole = false; // just in case lastPoint = new Vector2(x, y); }
public void EndPath() { if (!buildingPath) { return; } buildingPath = false; inHole = false; ShapeDef shapeDef = new ShapeDef(ShapeType.Path); shapeDef.pathDef = currentPath; shapeDef.bounds = ComputePathBounds(); ClampHoles(shapeDef.pathDef.holeRange, shapeDef.bounds); shapes.Add(shapeDef); currentPath = default; lastPoint.x = 0; lastPoint.y = 0; }
public void BeginPath() { requiresGeometryUpdate = true; if (buildingPath) { // delete old path if it hasn't ended pointList.size = currentPath.pointRange.start; holeList.size = currentPath.holeRange.start; } currentShapeRange = new RangeInt(shapeList.size, 0); currentPath = new PathDef(); currentPath.pointRange.start = pointList.size; currentPath.holeRange.start = holeList.size; inHole = false; // just in case }
public void BeginPath(float x, float y) { requiresGeometryUpdate = true; if (buildingPath) { // delete old path if it hasn't ended pointList.size = currentPath.pointRange.start; holeList.size = currentPath.holeRange.start; } currentShapeRange = new RangeInt(shapeList.size, 0); currentPath = new PathDef(); currentPath.pointRange.start = pointList.size; currentPath.holeRange.start = holeList.size; currentPath.pointRange.length++; pointList.Add(new PathPoint(x, y, PointFlag.Corner)); buildingPath = true; inHole = false; // just in case lastPoint = new Vector2(x, y); }
public void EndPath() { requiresGeometryUpdate = true; if (!buildingPath) { return; } currentShapeRange.length++; buildingPath = false; inHole = false; ShapeDef shapeDef = new ShapeDef(ShapeType.Path); shapeDef.pointRange = currentPath.pointRange; shapeDef.holeRange = currentPath.holeRange; shapeDef.bounds = ComputePathBounds(); ClampHoles(shapeDef.holeRange, shapeDef.bounds); shapeList.Add(shapeDef); currentPath = default; lastPoint.x = 0; lastPoint.y = 0; }