New IO structure, unexpexted error in C code
This commit is contained in:
@@ -21,8 +21,3 @@
|
||||
|
||||
\end{document}
|
||||
|
||||
其中,example.bib文件的内容如下:
|
||||
|
||||
@article{ref1, author = {作者1}, title = {标题1}, journal = {期刊1}, year = {年份1}, volume = {卷号1}, number = {期号1}, pages = {页码1}, }
|
||||
|
||||
@book{ref2, author = {作者2}, title = {标题2}, publisher = {出版社2}, year = {年份2}, }
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -66,14 +66,14 @@
|
||||
<Position X="19.75" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AgAAAAAAAAAAogAAAABAAAAAAACAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Logic\ContainerNode.cs</FileName>
|
||||
<FileName>Logic\LinkedListNode.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="StgSharp.ContainerNode<T>" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Class Name="StgSharp.LinkedListNode<T>" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="44.75" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>BhAAAAAAAAAAAgAAAAAABAAAAAAAAAAoAAAgAAAAAAA=</HashCode>
|
||||
<FileName>Logic\ContainerNode.cs</FileName>
|
||||
<FileName>Logic\LinkedListNode.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Geometries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
@@ -21,8 +17,8 @@ namespace StgSharp
|
||||
|
||||
public static void AddPool(Pool pool)
|
||||
{
|
||||
ProgramTimeLine.allPool.Add(pool);
|
||||
ProgramTimeLine._currentPool = pool;
|
||||
TimeLine.allPool.Add(pool);
|
||||
TimeLine._currentPool = pool;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using StgSharp.Control;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
public static partial class Instruction
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
using StgSharp.Geometries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal static unsafe partial class internalIO
|
||||
{
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "initTriangle")]
|
||||
internal static unsafe extern triangleVertexArray initTriangleVertex();
|
||||
internal static extern unsafe triangleVertexArray initTriangleVertex();
|
||||
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "initPolygon4")]
|
||||
internal static unsafe extern Polygon4VertexArray initPolygon4Vertex();
|
||||
internal static extern unsafe Polygon4VertexArray initPolygon4Vertex();
|
||||
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "initPolygon5")]
|
||||
internal static unsafe extern Polygon5VertexArray initPolygon5Vertex();
|
||||
internal static extern unsafe Polygon5VertexArray initPolygon5Vertex();
|
||||
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "inputTriangle")]
|
||||
internal static unsafe extern void internalLoadTriangle(triangleVertexArray triangle);
|
||||
internal static extern unsafe void internalLoadTriangle(triangleVertexArray triangle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,35 +1,47 @@
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.GL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal static partial class internalIO
|
||||
{
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitGL")]
|
||||
[DllImport("StgSharpGraphics.dll",
|
||||
EntryPoint = "loadGLApi", CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern GraphicIOPack InternalInitGraphicApi();
|
||||
|
||||
[DllImport("StgSharpGraphics.dll",
|
||||
EntryPoint = "InitGL", CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe void InternalInitGL();
|
||||
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitWindow")]
|
||||
[DllImport("StgSharpGraphics.dll",
|
||||
EntryPoint = "InitWindow", CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe IntPtr InternalInitWindow(formInfo win);
|
||||
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "CompileShader")]
|
||||
internal static unsafe extern void InternalCompileShader
|
||||
[DllImport("StgSharpGraphics.dll",
|
||||
EntryPoint = "CompileShader", CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe void InternalCompileShader
|
||||
(
|
||||
shaderObject* shaderObj
|
||||
);
|
||||
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "RenderWindow")]
|
||||
internal static unsafe extern void InternalRenderWindow
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "SSGraphicShouldWindowClose",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe int InternalShouldFormClose(IntPtr formPtr);
|
||||
|
||||
[DllImport("StgSharpGraphics.dll",
|
||||
EntryPoint = "RenderWindow", CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe void InternalRenderWindow
|
||||
(
|
||||
IntPtr window,
|
||||
formInfo info,
|
||||
shaderObject* shaderObj
|
||||
);
|
||||
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow")]
|
||||
internal static unsafe extern void TerminateWindow(shaderObject* shaderObj);
|
||||
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow"
|
||||
, CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe void TerminateWindow(shaderObject* shaderObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
internal delegate void InternalInitGLDelegate();
|
||||
internal delegate IntPtr InternalGLcreateWindowDelegate
|
||||
(int width, int height, char[] tittle, IntPtr monitor, IntPtr share);
|
||||
internal delegate void InternalGLmakeContextCurrent(IntPtr window);
|
||||
internal delegate void InternalGLswapInterval(int interval);
|
||||
internal delegate void InternalGLclearColorDelegate
|
||||
(float red, float green, float blue, float alpha);
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct GraphicIOPack
|
||||
{
|
||||
internal InternalInitGLDelegate InternalLoadGL;
|
||||
internal InternalGLcreateWindowDelegate InternalGLcreatWindow;
|
||||
internal InternalGLmakeContextCurrent InternalGLmakeContextCurrent;
|
||||
internal InternalGLswapInterval InternalGLswapInterval;
|
||||
internal InternalGLclearColorDelegate InternalGLclearColor;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
|
||||
public delegate int InitWindow(int width, int height);
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GraphicIOPack
|
||||
{
|
||||
public InitWindow initWindowPtr = default;
|
||||
|
||||
|
||||
|
||||
public GraphicIOPack()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
using StgSharp.Geometries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
@@ -9,7 +6,7 @@ namespace StgSharp.Control
|
||||
{
|
||||
public static void Point(Point p)
|
||||
{
|
||||
ProgramTimeLine._currentPool._pointContainer.Remove(p);
|
||||
TimeLine._currentPool._pointContainer.Remove(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using StgSharp.Entities;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.GL;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
public static class ProgramTimeLine
|
||||
public static class TimeLine
|
||||
{
|
||||
[AllowNull]
|
||||
internal static Pool _currentPool = default;
|
||||
@@ -16,13 +16,13 @@ namespace StgSharp.Control
|
||||
/// <summary>
|
||||
/// Tick counter count the frames passed since the program start.
|
||||
/// </summary>
|
||||
public readonly static Counter<uint> tickCounter = new Counter<uint>(0,1,1);
|
||||
public static readonly Counter<uint> tickCounter = new Counter<uint>(0, 1, 1);
|
||||
|
||||
[AllowNull]
|
||||
internal static TimelineBlock currentOperation;
|
||||
private static bool isPaused = false;
|
||||
|
||||
static ProgramTimeLine()
|
||||
static TimeLine()
|
||||
{
|
||||
allForm = new LinkedList<Form>();
|
||||
allPool = new LinkedList<Pool>();
|
||||
@@ -55,6 +55,19 @@ namespace StgSharp.Control
|
||||
|
||||
}
|
||||
|
||||
public static unsafe void StartProgram()
|
||||
{
|
||||
foreach (Form form in allForm)
|
||||
{
|
||||
if (Graphic.ShouldFormClose(form))
|
||||
{
|
||||
internalIO.InternalRenderWindow(
|
||||
form.windowPtr,
|
||||
form.info,
|
||||
(shaderObject*)form.shader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
public abstract class TimelineBlock : INode<TimelineBlock>
|
||||
public abstract class TimelineBlock
|
||||
{
|
||||
|
||||
public abstract void OnUpdating();
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Entities
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
public abstract class BehaviorArgs
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using StgSharp.Control;
|
||||
using System;
|
||||
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
@@ -20,7 +19,7 @@ namespace StgSharp.Entities
|
||||
{
|
||||
_dieBulletLauncher.Launch();
|
||||
_awardLauncher.Launch();
|
||||
this._id.Remove();
|
||||
TimeLine._currentPool._enemyContainer.Remove(this);
|
||||
}
|
||||
|
||||
internal override void OnRenderFrame()
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using StgSharp.Control;
|
||||
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
@@ -20,7 +18,7 @@ namespace StgSharp.Entities
|
||||
{
|
||||
_dieBulletLauncher.Launch();
|
||||
_awardLauncher.Launch();
|
||||
this._id.Remove();
|
||||
TimeLine._currentPool._enemyContainer.Remove(this);
|
||||
}
|
||||
|
||||
internal override void OnRenderFrame()
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Entities
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
public abstract class EntityPartical : IEntity
|
||||
{
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Geometries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Math;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public abstract class IEntity:INode<IEntity>
|
||||
public abstract class IEntity
|
||||
{
|
||||
internal Point _pos;
|
||||
internal LinkedList<IPlainGeometry> _collisionBox;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using StgSharp.Entities;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Launcher<T>:INode<Launcher<T>> where T : IEntity
|
||||
public class Launcher<T> where T : IEntity
|
||||
{
|
||||
/*
|
||||
*用于发射其他的实体,主要是子弹 和 掉落物
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
namespace StgSharp
|
||||
{
|
||||
public abstract class Player : IEntity
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public delegate float ExpressionHandler
|
||||
(
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using StgSharp;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using StgSharp.Math;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
/// </summary>
|
||||
public abstract class IPlainGeometry:INode<IPlainGeometry>
|
||||
public abstract class IPlainGeometry
|
||||
{
|
||||
protected readonly uint bornTick;
|
||||
internal readonly Point refOrigin;
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using Steamworks;
|
||||
using StgSharp;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
@@ -10,7 +7,7 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
internal Point center;
|
||||
|
||||
public override sealed Point RefPoint01 => center;
|
||||
public sealed override Point RefPoint01 => center;
|
||||
public sealed override Point RefPoint02 => vertex01;
|
||||
public sealed override Point RefPoint03 => vertex02;
|
||||
|
||||
@@ -41,9 +38,9 @@ namespace StgSharp.Geometries
|
||||
throw new UnusedVertexException();
|
||||
}
|
||||
|
||||
internal override sealed void OnRender(uint tick)
|
||||
internal sealed override void OnRender(uint tick)
|
||||
{
|
||||
uint nowTick = ProgramTimeLine.tickCounter._value;
|
||||
uint nowTick = TimeLine.tickCounter._value;
|
||||
this.vertex01.Position = RefOrigin.Position + movVertex01Operation(nowTick);
|
||||
this.vertex02.Position = RefOrigin.Position + movVertex02Operation(nowTick);
|
||||
this.vertex03.Position = 2 * center.Position - vertex01.Position;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
@@ -52,4 +49,5 @@ namespace StgSharp.Geometries
|
||||
plainParameter.Z = 1 / plainParameter.Z;
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
using StgSharp;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public unsafe class Point : INode<Point>, INullable
|
||||
public unsafe class Point
|
||||
{
|
||||
internal vec3d* positionPtr;
|
||||
internal readonly bool isVertex;
|
||||
@@ -59,7 +54,6 @@ namespace StgSharp.Geometries
|
||||
|
||||
public bool IsVertex => isVertex;
|
||||
|
||||
bool INullable.IsNull { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Update the coordinate of the point. If this is a moving point,
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
@@ -70,7 +67,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
uint nowTick = ProgramTimeLine.tickCounter._value;
|
||||
uint nowTick = TimeLine.tickCounter._value;
|
||||
this.vertex01.Position = RefOrigin.Position + movVertex01Operation(nowTick);
|
||||
this.vertex02.Position = RefOrigin.Position + movVertex02Operation(nowTick);
|
||||
this.vertex03.Position = RefOrigin.Position + movVertex03Operation(nowTick);
|
||||
|
||||
@@ -1 +1,12 @@
|
||||
using Steamworks;
using StgSharp.Control;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
namespace StgSharp.Geometries
{
public unsafe class Polygon5 : IPlainGeometry
{
internal Polygon5VertexArray vertexPtrAyyar;
internal Point _refOrigin;
internal readonly Point vertex1;
internal readonly Point vertex2;
internal readonly Point vertex3;
internal readonly Point vertex4;
internal readonly Point vertex5;
internal readonly int _vertexCount;
public override Point RefPoint01 => vertex1;
public override Point RefPoint02 => vertex2;
public override Point RefPoint03 => vertex3;
internal GetLocationHandler movP01Operation = default;
internal GetLocationHandler movP02Operation = default;
internal GetLocationHandler movP03Operation = default;
internal GetLocationHandler movP04Operation = default;
internal GetLocationHandler movP05Operation = default;
public GetLocationHandler MovP01Operation { get => movP01Operation; }
public GetLocationHandler MovP02Operation { get => movP02Operation; }
public GetLocationHandler MovP03Operation { get => movP03Operation; }
public GetLocationHandler MovP04Operation { get => movP04Operation; }
public GetLocationHandler MovP05Operation { get => movP05Operation; }
public unsafe Polygon5()
{
vertexPtrAyyar = internalIO.initPolygon5Vertex();
vertex1 = new Point(vertexPtrAyyar.vertex1);
vertex2 = new Point(vertexPtrAyyar.vertex2);
vertex3 = new Point(vertexPtrAyyar.vertex3);
vertex4 = new Point(vertexPtrAyyar.vertex4);
vertex5 = new Point(vertexPtrAyyar.vertex5);
}
public virtual vec3d movPoint01(uint tick)=> movP01Operation.Invoke(ProgramTimeLine.tickCounter._value);
public virtual vec3d movPoint02(uint tick)=> movP02Operation.Invoke(ProgramTimeLine.tickCounter._value);
public virtual vec3d movPoint03(uint tick)=> movP03Operation.Invoke(ProgramTimeLine.tickCounter._value);
public virtual vec3d movPoint04(uint tick)=> movP04Operation.Invoke(ProgramTimeLine.tickCounter._value);
public virtual vec3d movPoint05(uint tick)=> movP05Operation.Invoke(ProgramTimeLine.tickCounter._value);
internal override void OnRender(uint tick)
{
uint nowTick = tick - BornTime;
vertex1.Position = RefOrigin.Position + movPoint01(nowTick);
vertex2.Position = RefOrigin.Position + movPoint02(nowTick);
vertex3.Position = RefOrigin.Position + movPoint03(nowTick);
vertex4.Position = RefOrigin.Position + movPoint04(nowTick);
vertex5.Position = RefOrigin.Position + movPoint05(nowTick);
}
public override Line[] GetAllSides()
{
return new Line[5]
{
new Line(vertex1,vertex2),
new Line(vertex2,vertex3),
new Line(vertex3,vertex4),
new Line(vertex4,vertex5),
new Line(vertex5,vertex1)
};
}
public override Plain GetPlain()
{
return new Plain(vertex1,vertex2,vertex3);
}
}
}
|
||||
using StgSharp.Control;
using StgSharp.Math;
namespace StgSharp.Geometries
{
public unsafe class Polygon5 : IPlainGeometry
{
internal Polygon5VertexArray vertexPtrAyyar;
internal Point _refOrigin;
internal readonly Point vertex1;
internal readonly Point vertex2;
internal readonly Point vertex3;
internal readonly Point vertex4;
internal readonly Point vertex5;
internal readonly int _vertexCount;
public override Point RefPoint01 => vertex1;
public override Point RefPoint02 => vertex2;
public override Point RefPoint03 => vertex3;
internal GetLocationHandler movP01Operation = default;
internal GetLocationHandler movP02Operation = default;
internal GetLocationHandler movP03Operation = default;
internal GetLocationHandler movP04Operation = default;
internal GetLocationHandler movP05Operation = default;
public GetLocationHandler MovP01Operation { get => movP01Operation; }
public GetLocationHandler MovP02Operation { get => movP02Operation; }
public GetLocationHandler MovP03Operation { get => movP03Operation; }
public GetLocationHandler MovP04Operation { get => movP04Operation; }
public GetLocationHandler MovP05Operation { get => movP05Operation; }
public unsafe Polygon5()
{
vertexPtrAyyar = internalIO.initPolygon5Vertex();
vertex1 = new Point(vertexPtrAyyar.vertex1);
vertex2 = new Point(vertexPtrAyyar.vertex2);
vertex3 = new Point(vertexPtrAyyar.vertex3);
vertex4 = new Point(vertexPtrAyyar.vertex4);
vertex5 = new Point(vertexPtrAyyar.vertex5);
}
public virtual vec3d movPoint01(uint tick) => movP01Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movPoint02(uint tick) => movP02Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movPoint03(uint tick) => movP03Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movPoint04(uint tick) => movP04Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
public virtual vec3d movPoint05(uint tick) => movP05Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
|
||||
internal override void OnRender(uint tick)
{
uint nowTick = tick - BornTime;
vertex1.Position = RefOrigin.Position + movPoint01(nowTick);
vertex2.Position = RefOrigin.Position + movPoint02(nowTick);
vertex3.Position = RefOrigin.Position + movPoint03(nowTick);
vertex4.Position = RefOrigin.Position + movPoint04(nowTick);
vertex5.Position = RefOrigin.Position + movPoint05(nowTick);
}
public override Line[] GetAllSides()
{
return new Line[5]
{
new Line(vertex1,vertex2),
new Line(vertex2,vertex3),
new Line(vertex3,vertex4),
new Line(vertex4,vertex5),
new Line(vertex5,vertex1)
};
}
public override Plain GetPlain()
{
return new Plain(vertex1, vertex2, vertex3);
}
}
}
|
||||
@@ -1,10 +1,5 @@
|
||||
using Steamworks;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
@@ -42,32 +37,32 @@ namespace StgSharp.Geometries
|
||||
|
||||
public virtual vec3d movPoint01(uint tick)
|
||||
{
|
||||
return movP01Operation.Invoke(ProgramTimeLine.tickCounter._value);
|
||||
return movP01Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movPoint02(uint tick)
|
||||
{
|
||||
return movP02Operation.Invoke(ProgramTimeLine.tickCounter._value);
|
||||
return movP02Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movPoint03(uint tick)
|
||||
{
|
||||
return movP03Operation.Invoke(ProgramTimeLine.tickCounter._value);
|
||||
return movP03Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movPoint04(uint tick)
|
||||
{
|
||||
return movP04Operation.Invoke(ProgramTimeLine.tickCounter._value);
|
||||
return movP04Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movPoint05(uint tick)
|
||||
{
|
||||
return movP05Operation.Invoke(ProgramTimeLine.tickCounter._value);
|
||||
return movP05Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
public virtual vec3d movPoint06(uint tick)
|
||||
{
|
||||
return movP06Operation.Invoke(ProgramTimeLine.tickCounter._value);
|
||||
return movP06Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using StgSharp.Math;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
@@ -10,11 +6,11 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
internal Point center;
|
||||
|
||||
public override sealed Point RefPoint01=>center;
|
||||
public sealed override Point RefPoint01 => center;
|
||||
|
||||
public override sealed Point RefPoint02 => vertex01;
|
||||
public sealed override Point RefPoint02 => vertex01;
|
||||
|
||||
public override sealed Point RefPoint03 => vertex02;
|
||||
public sealed override Point RefPoint03 => vertex02;
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +31,7 @@ namespace StgSharp.Geometries
|
||||
return this.center.Position * 2 - this.vertex02.Position;
|
||||
}
|
||||
|
||||
internal override sealed void OnRender(uint tick)
|
||||
internal sealed override void OnRender(uint tick)
|
||||
{
|
||||
tick -= bornTick;
|
||||
this.MovCenter(tick);
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using StgSharp;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
@@ -21,9 +16,9 @@ namespace StgSharp.Geometries
|
||||
internal GetLocationHandler movVertex02Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movVertex03Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
public override sealed Point RefPoint01 => vertex1;
|
||||
public override sealed Point RefPoint02 => vertex2;
|
||||
public override sealed Point RefPoint03 => vertex3;
|
||||
public sealed override Point RefPoint01 => vertex1;
|
||||
public sealed override Point RefPoint02 => vertex2;
|
||||
public sealed override Point RefPoint03 => vertex3;
|
||||
|
||||
public GetLocationHandler MovVertex01Operation => this.movVertex01Opearion;
|
||||
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
|
||||
@@ -48,9 +43,9 @@ namespace StgSharp.Geometries
|
||||
vertexArray.vertex3Ptr = this.vertex1.positionPtr;
|
||||
|
||||
/**/
|
||||
ProgramTimeLine._currentPool._pointContainer.Add(vertex1);
|
||||
ProgramTimeLine._currentPool._pointContainer.Add(vertex2);
|
||||
ProgramTimeLine._currentPool._pointContainer.Add(vertex3);
|
||||
TimeLine._currentPool._pointContainer.Add(vertex1);
|
||||
TimeLine._currentPool._pointContainer.Add(vertex2);
|
||||
TimeLine._currentPool._pointContainer.Add(vertex3);
|
||||
/**/
|
||||
|
||||
|
||||
@@ -67,7 +62,7 @@ namespace StgSharp.Geometries
|
||||
vertex1.Position = vertex01;
|
||||
}
|
||||
|
||||
internal override sealed void OnRender(uint tick)
|
||||
internal sealed override void OnRender(uint tick)
|
||||
{
|
||||
tick -= this.bornTick;
|
||||
vertex1.Position = RefOrigin.Position + MovVertex01(tick);
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using StgSharp.Graphics.GL;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
@@ -18,11 +14,11 @@ namespace StgSharp.Graphics
|
||||
public string name;
|
||||
}
|
||||
|
||||
public unsafe class Form:INode<Form>
|
||||
public unsafe class Form
|
||||
{
|
||||
internal IntPtr windowPtr;
|
||||
internal formInfo info;
|
||||
internal shaderObject shader;
|
||||
internal IntPtr shader;
|
||||
internal LinkedList<Pool> allControl;
|
||||
|
||||
public vec2d Size
|
||||
@@ -73,14 +69,12 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
internal unsafe void defualtInit()
|
||||
{
|
||||
fixed (shaderObject* shaderObj = &this.shader)
|
||||
{
|
||||
IntPtr windowPtr = Graphic.InitWindow(this);
|
||||
internalIO.InternalCompileShader(shaderObj);
|
||||
internalIO.InternalRenderWindow(windowPtr, this.info, shaderObj);
|
||||
internalIO.TerminateWindow(shaderObj);
|
||||
}
|
||||
internalIO.InternalCompileShader((shaderObject*)this.shader);
|
||||
internalIO.InternalRenderWindow(windowPtr, this.info, (shaderObject*)this.shader);
|
||||
internalIO.TerminateWindow((shaderObject*)shader);
|
||||
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
@@ -93,12 +87,9 @@ namespace StgSharp.Graphics
|
||||
|
||||
public void Show()
|
||||
{
|
||||
fixed (shaderObject* shaderObj = &this.shader)
|
||||
{
|
||||
internalIO.InternalCompileShader(shaderObj);
|
||||
internalIO.InternalRenderWindow(this.windowPtr, this.info, shaderObj);
|
||||
internalIO.TerminateWindow(shaderObj);
|
||||
}
|
||||
internalIO.InternalCompileShader((shaderObject*)shader);
|
||||
internalIO.InternalRenderWindow(this.windowPtr, this.info, (shaderObject*)shader);
|
||||
internalIO.TerminateWindow((shaderObject*)shader);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
//rename types in style of GLFW
|
||||
|
||||
using GLFWbool = Boolean;
|
||||
using _glfw = _GLFWlibrary;
|
||||
|
||||
public unsafe static partial class GLFW
|
||||
public static unsafe partial class GLFW
|
||||
{
|
||||
internal static _glfw glfw = new _glfw();
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal enum VkStructureType : uint
|
||||
{
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
//rename types in style of GLFW
|
||||
|
||||
using GLFWbool = Boolean;
|
||||
using _glfw = _GLFWlibrary;
|
||||
|
||||
//strucs defined in glfw3.h
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Graphics.GL
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public static unsafe partial class Graphic
|
||||
{
|
||||
public static void InitGL()
|
||||
{
|
||||
InternalInitGL();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StgSharp.Control;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public static unsafe partial class Graphic
|
||||
{
|
||||
internal static InternalInitGLDelegate InternalInitGL;
|
||||
internal static InternalGLcreateWindowDelegate InternalGLcreatWindow;
|
||||
internal static InternalGLmakeContextCurrent InternalGLmakeContextCurrent;
|
||||
internal static InternalGLswapInterval InternalGLswapInterval;
|
||||
internal static InternalGLclearColorDelegate InternalGLclearColor;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,31 @@
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.GL;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public static unsafe class Graphic
|
||||
public static unsafe partial class Graphic
|
||||
{
|
||||
public static unsafe void LoadGL()
|
||||
{
|
||||
GraphicIOPack GLpack = internalIO.InternalInitGraphicApi();
|
||||
}
|
||||
|
||||
internal static byte[] loadShaderCodeStr(string str)
|
||||
{
|
||||
byte[] cahrStr;
|
||||
try
|
||||
{
|
||||
cahrStr = System.Text.Encoding.ASCII.GetBytes(str);
|
||||
return cahrStr;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init a form, attach its data to GLFW program,
|
||||
/// and return the pointer of the GLFW package of the form.
|
||||
@@ -39,9 +53,14 @@ namespace StgSharp
|
||||
|
||||
public static unsafe void LoadForm(Form form)
|
||||
{
|
||||
ProgramTimeLine.allForm.Add(form);
|
||||
TimeLine.allForm.Add(form);
|
||||
}
|
||||
|
||||
public static unsafe bool ShouldFormClose(Form form)
|
||||
{
|
||||
int a = internalIO.InternalShouldFormClose(form.windowPtr);
|
||||
return a != 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public abstract class INode<T> where T : INode<T>
|
||||
{
|
||||
[NotNull]
|
||||
protected ContainerNode<T> _id;
|
||||
|
||||
internal ContainerNode<T> ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
internal ContainerNode<T> Previous
|
||||
{
|
||||
get { return _id._previous; }
|
||||
set { _id._previous = value; }
|
||||
}
|
||||
|
||||
internal ContainerNode<T> Next
|
||||
{
|
||||
get { return _id._next; }
|
||||
set { _id._next = value; }
|
||||
}
|
||||
|
||||
public INode()
|
||||
{
|
||||
_id = new ContainerNode<T>(this as T);
|
||||
}
|
||||
|
||||
internal void SetId(ContainerNode<T> tContainer)
|
||||
{
|
||||
_id = tContainer;
|
||||
}
|
||||
|
||||
internal void SelfDestrcut()
|
||||
{
|
||||
_id._previous._next = _id._next;
|
||||
_id._next._previous = _id._previous;
|
||||
_id._next = null;
|
||||
_id._previous = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ContainerNode<T> : INullable where T : INode<T>
|
||||
{
|
||||
internal readonly T _value;
|
||||
|
||||
[AllowNull]
|
||||
internal ContainerNode<T> _previous;
|
||||
[AllowNull]
|
||||
internal ContainerNode<T> _next;
|
||||
|
||||
internal ContainerNode()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public ContainerNode(T t)
|
||||
{
|
||||
_value = t;
|
||||
_previous = new ContainerNode<T>();
|
||||
_next = new ContainerNode<T>();
|
||||
}
|
||||
|
||||
public virtual ContainerNode<T> Previous
|
||||
{
|
||||
get { return _previous; }
|
||||
set { _previous = value; }
|
||||
}
|
||||
|
||||
public ContainerNode<T> Next
|
||||
{
|
||||
get { return _next; }
|
||||
set { _next = value; }
|
||||
}
|
||||
|
||||
public T Value
|
||||
{
|
||||
get { return _value; }
|
||||
}
|
||||
|
||||
public bool IsNull
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
_previous.Next = _next;
|
||||
_next.Previous = _previous;
|
||||
_next = default(ContainerNode<T>);
|
||||
_previous = default(ContainerNode<T>);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
using Microsoft.CSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
@@ -78,5 +75,17 @@ namespace StgSharp
|
||||
{
|
||||
_value = _defualtValue;
|
||||
}
|
||||
|
||||
public static Counter<T> operator ++(Counter<T> counter)
|
||||
{
|
||||
counter.QuickAdd();
|
||||
return counter;
|
||||
}
|
||||
|
||||
public static Counter<T> operator --(Counter<T> counter)
|
||||
{
|
||||
counter.QuickSub();
|
||||
return counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,41 @@
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Logic;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class LinkedList<T>:INode<LinkedList<T>>,IEnumerable where T: INode<T>
|
||||
public class LinkedList<T> : IEnumerable
|
||||
{
|
||||
internal readonly ContainerNode<T> _heading;
|
||||
private ContainerNode<T> _cache;
|
||||
internal readonly LinkedListNode<T> _heading;
|
||||
private LinkedListNode<T> _cache;
|
||||
private bool isEmpty;
|
||||
public Counter<uint> count = new Counter<uint>(0, 1, 1);
|
||||
|
||||
public LinkedList()
|
||||
{
|
||||
_heading = new ContainerNode<T>(null);
|
||||
_heading = new LinkedListNode<T>();
|
||||
isEmpty = true;
|
||||
}
|
||||
|
||||
public T First
|
||||
{
|
||||
get { return _heading._next._value; }
|
||||
private set { _heading._next = value.ID; }
|
||||
/*
|
||||
* This setter is ued to reset the First node,
|
||||
* be careful when use this setter to avoid
|
||||
* unexpected risk of this List lose all nodes.
|
||||
*/
|
||||
private set { _heading._next = default; }
|
||||
}
|
||||
|
||||
public T Tail
|
||||
{
|
||||
get { return _heading._previous._value; }
|
||||
private set { _heading._previous = value.ID; }
|
||||
/*
|
||||
* This setter is ued to reset the Last node,
|
||||
* be careful when use this setter to avoid
|
||||
* unexpected risk of this List lose all nodes.
|
||||
*/
|
||||
private set { _heading._previous = default; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -40,54 +47,101 @@ namespace StgSharp
|
||||
//checkout if the linkedlist is null
|
||||
if (isEmpty)
|
||||
{
|
||||
_heading._next = t.ID;
|
||||
_heading._previous = t.ID;
|
||||
t.Next = _heading;
|
||||
t.Previous = _heading;
|
||||
LinkedListNode<T> node = new LinkedListNode<T>(t);
|
||||
_heading._next = node;
|
||||
_heading._previous = node;
|
||||
node.Next = _heading;
|
||||
node.Previous = _heading;
|
||||
isEmpty = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
t.Next = _heading;
|
||||
t.Previous = _heading.Previous;
|
||||
_heading._previous._next = t.ID;
|
||||
_heading._previous = t.ID;
|
||||
LinkedListNode<T> node = new LinkedListNode<T>(t);
|
||||
node.Next = _heading;
|
||||
node.Previous = _heading.Previous;
|
||||
_heading._previous._next = node;
|
||||
_heading._previous = node;
|
||||
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
public void Remove(T node)
|
||||
public void Remove(T value)
|
||||
{
|
||||
foreach (INode<T> item in this)
|
||||
{
|
||||
if (item == node)
|
||||
{
|
||||
node.SelfDestrcut();
|
||||
break;
|
||||
}
|
||||
}
|
||||
LinkedListNode<T> node = Find(value);
|
||||
node._next._previous = node._previous;
|
||||
node._previous._next = node._next;
|
||||
node._previous = null;
|
||||
node._next = null;
|
||||
count--;
|
||||
}
|
||||
|
||||
public void RemoveTail()
|
||||
{
|
||||
//check out if the list has only one member
|
||||
if (Tail == First)
|
||||
if (count._value == 1)
|
||||
{
|
||||
First = default;
|
||||
|
||||
|
||||
isEmpty = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Tail.Previous.Next = _heading;
|
||||
Tail.Next = null;
|
||||
_heading.Previous.Next = _heading;
|
||||
}
|
||||
count--;
|
||||
}
|
||||
|
||||
internal LinkedListNode<T> Find(T value)
|
||||
{
|
||||
foreach (LinkedListNode<T> node in this)
|
||||
{
|
||||
if (node._value.Equals(value))
|
||||
{
|
||||
return node;
|
||||
}
|
||||
}
|
||||
throw new Exception("Value not found in this LinkedList");
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_heading._previous = null;
|
||||
_heading._next = null;
|
||||
count.Reset();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new LinkedListEnumrator<T>(this);
|
||||
}
|
||||
|
||||
internal struct LinkedListEnumrator<T> : IEnumerator
|
||||
{
|
||||
private LinkedList<T> _target;
|
||||
LinkedListNode<T> enumrator;
|
||||
|
||||
public LinkedListEnumrator(LinkedList<T> target)
|
||||
{
|
||||
_target = target;
|
||||
enumrator = target._heading;
|
||||
}
|
||||
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get { return enumrator._value; }
|
||||
}
|
||||
|
||||
bool IEnumerator.MoveNext()
|
||||
{
|
||||
enumrator = enumrator._next;
|
||||
return enumrator == default(LinkedListNode<T>);
|
||||
}
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
enumrator = _target._heading;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
internal class LinkedListEnumrator<T> : IEnumerator where T : INode<T>
|
||||
{
|
||||
private LinkedList<T> _target;
|
||||
ContainerNode<T> enumrator;
|
||||
|
||||
public LinkedListEnumrator(LinkedList<T> target)
|
||||
{
|
||||
_target = target;
|
||||
enumrator = target._heading;
|
||||
}
|
||||
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get { return enumrator._value; }
|
||||
}
|
||||
|
||||
bool IEnumerator.MoveNext()
|
||||
{
|
||||
enumrator = enumrator._next;
|
||||
return enumrator == default(ContainerNode<T>);
|
||||
}
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
enumrator = _target._heading;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal class LinkedListNode<T>
|
||||
{
|
||||
internal readonly T _value;
|
||||
|
||||
[AllowNull]
|
||||
internal LinkedListNode<T> _previous;
|
||||
[AllowNull]
|
||||
internal LinkedListNode<T> _next;
|
||||
internal LinkedList<T> list;
|
||||
|
||||
internal LinkedListNode()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public LinkedListNode(T t)
|
||||
{
|
||||
_value = t;
|
||||
_previous = new LinkedListNode<T>();
|
||||
_next = new LinkedListNode<T>();
|
||||
}
|
||||
|
||||
public virtual LinkedListNode<T> Previous
|
||||
{
|
||||
get { return _previous; }
|
||||
set { _previous = value; }
|
||||
}
|
||||
|
||||
public LinkedListNode<T> Next
|
||||
{
|
||||
get { return _next; }
|
||||
set { _next = value; }
|
||||
}
|
||||
|
||||
public T Value
|
||||
{
|
||||
get { return _value; }
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
_previous.Next = _next;
|
||||
_next.Previous = _previous;
|
||||
_next = default(LinkedListNode<T>);
|
||||
_previous = default(LinkedListNode<T>);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,9 @@
|
||||
using Steamworks;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Entities;
|
||||
using StgSharp.Entities;
|
||||
using StgSharp.Geometries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Pool:INode<Pool>
|
||||
public class Pool
|
||||
{
|
||||
internal LinkedList<Point> _pointContainer;
|
||||
internal LinkedList<IPlainGeometry> geometryContainer;
|
||||
@@ -34,7 +28,6 @@ namespace StgSharp
|
||||
|
||||
private void initContainers()
|
||||
{
|
||||
_id = new ContainerNode<Pool>(this);
|
||||
_pointContainer = new LinkedList<Point>();
|
||||
_bulletContainer = new LinkedList<IEntity>();
|
||||
_awardContainer = new LinkedList<IEntity>();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
public abstract class QuickClearNode<T> where T : QuickClearNode<T>
|
||||
{
|
||||
internal LinkedList<LinkedListNode<T>> _idList
|
||||
= new LinkedList<LinkedListNode<T>>();
|
||||
|
||||
internal void QuickDestruct(LinkedList<T> list)
|
||||
{
|
||||
foreach (LinkedListNode<T> id in _idList)
|
||||
{
|
||||
if (id.list == list)
|
||||
{
|
||||
RecycleBin.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static LinkedList<LinkedListNode<T>> RecycleBin
|
||||
= new LinkedList<LinkedListNode<T>>();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
using StgSharp.Geometries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
internal class Cordination
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Runtime;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user