daily update on 20230105 by nitload youmu

This commit is contained in:
Nitload
2023-01-06 00:53:51 +08:00
parent e464ac56ba
commit 9c2f69ff9f
29 changed files with 192 additions and 18 deletions
Binary file not shown.
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
using GLFWDotNet;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Control
{
public static class Add
{
public static void Point(IGeometry geometry)
{
Point p = new Point();
p.getXHandler+=geometry.SetPointArray;
TimeLine._cache.pointContainer.Add(p);
}
public static void Line(Point p, float vecX,float vecY)
{
Line l = new Line
{
endpoint = p,
vecX = vecX,
vecY = vecY
};
TimeLine._cache.geometryContainer.Add(l);
}
}
}
+20
View File
@@ -0,0 +1,20 @@
using StgSharp.Logic;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Control
{
public static class Remove
{
public static void Point(Point p)
{
Logic.LinkedListNode<INode> _cache = p.ID;
_cache.Previous.Next=_cache.Next;
_cache.Next.Previous = _cache.Previous;
_cache.Next = default(Logic.LinkedListNode<INode>);
_cache.Previous = default(Logic.LinkedListNode<INode>);
}
}
}
@@ -7,9 +7,11 @@ namespace StgSharp.Control
{ {
public static class TimeLine public static class TimeLine
{ {
public static Pool _cache;
public static Counter<uint> tickCounter public static Counter<uint> tickCounter
= new Counter<uint>(0,1,1); = new Counter<uint>(0,1,1);
} }
} }
+2 -2
View File
@@ -6,9 +6,9 @@ using System.Text;
namespace StgSharp.Entities namespace StgSharp.Entities
{ {
public interface IEntity public interface IEntity:INode
{ {
public Geometry CollisionShape { get; set; } public IGeometry CollisionShape { get; set; }
public Sensor CollisionSensor { get; set; } public Sensor CollisionSensor { get; set; }
@@ -0,0 +1,41 @@
using StgSharp.Logic;
using StgSharp.Geometries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public class Circle : IGeometry
{
private Logic.LinkedListNode<INode> _id;
internal Point _referencePoint;
internal float _vecX;
internal float _vecY;
public Point ReferencePoint
{
get { return _referencePoint; }
}
public float vecX
{
get { return _vecX; }
}
public float vecY
{
get { return _vecY; }
}
public Logic.LinkedListNode<INode> ID
{
get { return _id; }
}
float IGeometry.SetPointArray(Counter<uint> tickCounter)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,24 @@
using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public interface IGeometry:INode
{
public Point ReferencePoint
{
get;
}
public float vecX
{
get;
}
public float SetPointArray(Counter<uint> tickCounter);
}
}
+32 -5
View File
@@ -1,17 +1,44 @@
using StgSharp.Logic; using StgSharp.Control;
using StgSharp.Logic;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace StgSharp.Geometries namespace StgSharp.Geometries
{ {
public class Line:Geometry,INode public class Line:IGeometry
{ {
private Logic.LinkedListNode<INode> _id;
internal Point _referencePoint;
internal float _vecX;
internal float _vecY;
public Point ReferencePoint
public void SetPointArray()
{ {
get { return _referencePoint; }
} }
public float vecX
{
get { return _vecX; }
}
internal float vecY
{
get { return _vecY; }
}
public Logic.LinkedListNode<INode> ID
{
get { return _id; }
}
public float SetPointArray(Counter<uint> tickCounter)
{
return 0.0f;
}
} }
} }
@@ -5,15 +5,10 @@ using System.Text;
namespace StgSharp.Geometries namespace StgSharp.Geometries
{ {
public class Geometry:INode public class Rectangle
{ {
public void SetPointArray()
{
}
} }
} }
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public class Square:IGeometry
{
internal Point _referrencePoint;
public Point ReferrencePoint
{
get { return _referrencePoint; }
}
}
}
@@ -4,6 +4,7 @@ using StgSharp.Logic;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Security.Cryptography;
using System.Text; using System.Text;
@@ -11,10 +12,16 @@ namespace StgSharp.Geometries
{ {
public class Point: INode public class Point: INode
{ {
private Logic.LinkedListNode<INode> _id;
internal float x; internal float x;
internal float y; internal float y;
public Logic.LinkedListNode<INode> ID
{
get { return _id; }
}
public float X public float X
{ {
get get
+4 -1
View File
@@ -6,6 +6,9 @@ namespace StgSharp.Logic
{ {
public interface INode public interface INode
{ {
public LinkedListNode<INode> ID
{
get ;
}
} }
} }
@@ -4,7 +4,7 @@ using System.Text;
namespace StgSharp.Logic namespace StgSharp.Logic
{ {
internal class LinkedListNode<T> where T : INode public class LinkedListNode<T> where T : INode
{ {
internal readonly T _this; internal readonly T _this;
internal LinkedListNode<T> _previous; internal LinkedListNode<T> _previous;
+5 -1
View File
@@ -9,7 +9,11 @@ namespace StgSharp.Logic
public class Pool public class Pool
{ {
public LinkedList<Point> pointContainer; public LinkedList<Point> pointContainer;
public LinkedList<Geometry> geometryContainer; public LinkedList<IGeometry> geometryContainer;
public LinkedList<Sensor> sensorContainer;
public Line leftBoader; public Line leftBoader;
public Line rightBoader; public Line rightBoader;
+6 -1
View File
@@ -4,8 +4,13 @@ using System.Text;
namespace StgSharp.Logic namespace StgSharp.Logic
{ {
public class Sensor public class Sensor : INode
{ {
private LinkedListNode<INode> _id;
LinkedListNode<INode> INode.ID
{
get { return _id; }
}
} }
} }
+1
View File
@@ -1,4 +1,5 @@
using StgSharp; using StgSharp;
using StgSharp.Geometries;
using StgSharp.Logic; using StgSharp.Logic;
using System; using System;