daily update on 20240226 by nitload youmu

This commit is contained in:
YoumuLiu
2024-02-27 00:43:29 +08:00
parent a2241a5a58
commit 06e39f7a31
543 changed files with 230273 additions and 21423 deletions
+19 -13
View File
@@ -19,13 +19,13 @@ using System.Threading;
namespace StgSharp.Graphics
{
/// <summary>
///
///
/// </summary>
public abstract partial class Form
{
#region metadata
internal LinkedList<Control> allControl;
internal Vector4 backgroundColor;
internal unsafe GLcontext* contextID;
@@ -38,20 +38,25 @@ namespace StgSharp.Graphics
internal IntPtr windowID;
private bool closed;
internal IglFunc gl;
#endregion
#endregion metadata
#region form thread setting
internal FrameUpdateTimer timer = new FrameUpdateTimer();
private SemaphoreSlim _renderFinishSignal = new SemaphoreSlim(0, 1);
private SemaphoreSlim _renderStartSignal = new SemaphoreSlim(1, 1);
private bool isSingleThread = true;
private Thread renderThread;
#endregion
#endregion form thread setting
#region glapicount
private int missingAPIcount = 0;
private int problemAPIcount = 0;
#endregion
#endregion glapicount
protected Form()
{
@@ -76,7 +81,7 @@ namespace StgSharp.Graphics
}
/// <summary>
/// Representing
/// Representing
/// </summary>
public bool IsDoubleRendering
{
@@ -143,6 +148,7 @@ namespace StgSharp.Graphics
InternalIO.glfwSetFramebufferSizeCallback(windowID, handlerPtr);
}
}
unsafe ~Form()
{
Marshal.FreeHGlobal((IntPtr)contextID);
@@ -152,7 +158,7 @@ namespace StgSharp.Graphics
/// Init an OpenGl context if current form has not been binded to any context.
/// and set the context binded to current form as current OpenGL context.
/// </summary>
/// <exception cref="Exception">Something goes wrong and
/// <exception cref="Exception">Something goes wrong and
/// StgSharp fails in creating a new OpenGL context. </exception>
public unsafe void MakeAsCurrentContext()
{
@@ -179,6 +185,7 @@ namespace StgSharp.Graphics
windowID = windowPtr;
}
}
InternalIO.glfwMakeContextCurrent(windowID);
gl.SwitchContext();
}
@@ -210,14 +217,13 @@ namespace StgSharp.Graphics
/// Resize the current form
/// </summary>
/// <param name="size">
/// A <see cref="Vec2d"/> (width,height) representing the new size of current form
/// A <see cref="Vec2d"/> (width,height) representing the new size of current form
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetSize(Vec2d size)
{
this.Size = size;
InternalIO.glfwSetWindowSize(this.windowID, (int)size.X, (int)size.Y);
}
/// <summary>
@@ -293,12 +299,11 @@ namespace StgSharp.Graphics
/// <summary>
/// Behaviour of current form when in a render cycle.
/// When this form
/// When this form
/// </summary>
/// <param name="args"></param>
public abstract void Main(params object[] args);
/// <summary>
/// Init this form and render it on screen, and respond with operation
/// </summary>
@@ -408,6 +413,7 @@ namespace StgSharp.Graphics
}
}
}
#endregion
#endregion form main
}
}
}