daily update on 20230529 by nitload youmu

This commit is contained in:
Nitload
2023-05-29 04:36:01 +08:00
parent 9ca4a69a2a
commit 1874b32fb0
62 changed files with 1142 additions and 1250 deletions
+11
View File
@@ -8,6 +8,17 @@ namespace StgSharp
{
public static partial class Instruction
{
/// <summary>
/// Add a pool to timeline controller, and return the instance of the pool.
/// </summary>
/// <returns></returns>
public static Pool InitPool()
{
Pool pool = new Pool();
AddPool(pool);
return pool;
}
public static void AddPool(Pool pool)
{
ProgramTimeLine.allPool.Add(pool);
+11 -2
View File
@@ -8,7 +8,16 @@ namespace StgSharp
{
public static partial class internalIO
{
[DllImport("StgSharpGraphics.dll", EntryPoint = "initWindow")]
public static extern void Window(Window win);
[DllImport("StgSharpGraphics.dll", EntryPoint = "InitWindow")]
public static extern unsafe IntPtr InitWindow(Window win);
[DllImport("StgSharpGraphics.dll", EntryPoint = "CompileShader")]
public static unsafe extern void CompileShader();
[DllImport("StgSharpGraphics.dll", EntryPoint = "RenderWindow")]
public static unsafe extern void RenderWindow(IntPtr window, Window info);
[DllImport("StgSharpGraphics.dll", EntryPoint = "TerminateWindow")]
public static unsafe extern void TerminateWindow();
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ namespace StgSharp.Control
{
public static void Point(Point p)
{
ProgramTimeLine._currentPool.pointContainer.Remove(p);
ProgramTimeLine._currentPool._pointContainer.Remove(p);
}
@@ -13,18 +13,31 @@ namespace StgSharp.Geometries
public unsafe class Point : INode<Point>, INullable
{
internal vec3d* positionPtr;
internal readonly bool isVertex;
internal Point(vec3d* ptr)
{
positionPtr = ptr;
}
public Point()
{
IntPtr ptr = Marshal.AllocHGlobal(sizeof(vec3d));
positionPtr = (vec3d*)ptr.ToPointer();
}
public vec3d Position
{
get { return *positionPtr; }
set { *positionPtr = value; }
}
public vec3d* PositionPtr
{
get { return positionPtr; }
set { positionPtr = value; }
}
public float X
{
get { return (*this.positionPtr).X; }
@@ -43,7 +56,6 @@ namespace StgSharp.Geometries
set { (*this.positionPtr).Z = value; }
}
internal readonly bool isVertex;
public bool IsVertex => isVertex;
@@ -1,12 +1,20 @@
using System;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
/// <summary>
/// A square
/// </summary>
public class Square:Rectangle
{
public sealed override vec3d MovVertex02(uint tick)
{
return this.center.Position * 2 - this.vertex01.Position;
}
}
}
@@ -37,16 +37,23 @@ namespace StgSharp.Geometries
public Triangle()
{
this.vertexArray = internalIO.initTriangleVertex();
this.vertex1 = new Point(vertexArray.vertex1Ptr);
this.vertex2 = new Point(vertexArray.vertex2Ptr);
this.vertex3 = new Point(vertexArray.vertex3Ptr);
this.vertex1 = new Point();
this.vertex2 = new Point();
this.vertex3 = new Point();
this.vertexArray = new triangleVertexArray();
vertexArray.vertex1Ptr = this.vertex1.positionPtr;
vertexArray.vertex2Ptr = this.vertex1.positionPtr;
vertexArray.vertex3Ptr = this.vertex1.positionPtr;
/**/
ProgramTimeLine._currentPool.pointContainer.Add(vertex1);
ProgramTimeLine._currentPool.pointContainer.Add(vertex2);
ProgramTimeLine._currentPool.pointContainer.Add(vertex3);
ProgramTimeLine._currentPool._pointContainer.Add(vertex1);
ProgramTimeLine._currentPool._pointContainer.Add(vertex2);
ProgramTimeLine._currentPool._pointContainer.Add(vertex3);
/**/
}
public Triangle(
+1 -1
View File
@@ -11,7 +11,7 @@ namespace StgSharp.Graphics
{
public int width;
public int height;
public vec4d windowColor;
public vec4d color;
public string name;
}
}
+4 -63
View File
@@ -11,7 +11,7 @@ namespace StgSharp
{
public class Pool:INode<Pool>
{
internal LinkedList<Point> pointContainer;
internal LinkedList<Point> _pointContainer;
internal LinkedList<IPlainGeometry> geometryContainer;
internal LinkedList<IEntity> _bulletContainer;
internal LinkedList<IEntity> _awardContainer;
@@ -27,78 +27,19 @@ namespace StgSharp
public Line TopBoarder => topBoader;
public Line BottomBoarder => bottomBoader;
internal Sensor<EntityPartical> Sensor;
#if DEBUG
public Pool()
internal Pool()
{
initContainers();
Console.WriteLine("Pool init OK!");
}
#endif
public Pool(Line left, Line right, Line top, Line bottom)
{
initContainers();
topBoader = top;
bottomBoader= bottom;
rightBoader = right;
leftBoader = left;
}
public Pool( Geometries.Rectangle area)
{
vec3d vec = area.vertex01.Position - area.vertex02.Position;
if ((vec.X==0||vec.Y==0)&&vec.Z==0)
{
Line[] barders = area.GetAllSides();
if (area.vertex01.X>0)
{
if (area.vertex01.Y>0)
{
topBoader = barders[3];
rightBoader = barders[0];
bottomBoader = barders[1];
leftBoader = barders[2];
}
else
{
topBoader = barders[2];
rightBoader = barders[3];
bottomBoader = barders[0];
leftBoader = barders[1];
}
}
else
{
if (area.vertex01.Y > 0)
{
topBoader = barders[3];
rightBoader = barders[0];
bottomBoader = barders[1];
leftBoader = barders[2];
}
else
{
topBoader = barders[2];
rightBoader = barders[3];
bottomBoader = barders[0];
leftBoader = barders[1];
}
}
}
initContainers();
}
private void initContainers()
{
_id = new ContainerNode<Pool>(this);
pointContainer = new LinkedList<Point>();
_pointContainer = new LinkedList<Point>();
_bulletContainer = new LinkedList<IEntity>();
_awardContainer = new LinkedList<IEntity>();
_enemyContainer = new LinkedList<IEntity>();
geometryContainer = new LinkedList<IPlainGeometry>();
}
public void OnRender()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,12 @@
<name>StgSharp</name>
</assembly>
<members>
<member name="M:StgSharp.Instruction.InitPool">
<summary>
Add a pool to timeline controller, and return the instance of the pool.
</summary>
<returns></returns>
</member>
<member name="F:StgSharp.Control.ProgramTimeLine.tickCounter">
<summary>
Tick counter count the frames passed since the program start.
@@ -69,6 +75,11 @@
<param name="tick">当前游戏刻</param>
<returns></returns>
</member>
<member name="T:StgSharp.Geometries.Square">
<summary>
A square
</summary>
</member>
<member name="M:StgSharp.LinkedList`1.Add(`0)">
<summary>
Add an item to the tail of linked list.
@@ -4,6 +4,12 @@
<name>StgSharp</name>
</assembly>
<members>
<member name="M:StgSharp.Instruction.InitPool">
<summary>
Add a pool to timeline controller, and return the instance of the pool.
</summary>
<returns></returns>
</member>
<member name="F:StgSharp.Control.ProgramTimeLine.tickCounter">
<summary>
Tick counter count the frames passed since the program start.
@@ -69,6 +75,11 @@
<param name="tick">当前游戏刻</param>
<returns></returns>
</member>
<member name="T:StgSharp.Geometries.Square">
<summary>
A square
</summary>
</member>
<member name="M:StgSharp.LinkedList`1.Add(`0)">
<summary>
Add an item to the tail of linked list.