daily update on 20230623 by nitload youmu, SSG lib rewrite
This commit is contained in:
@@ -6,11 +6,53 @@ namespace StgSharp
|
||||
{
|
||||
public static unsafe partial class Graphic
|
||||
{
|
||||
internal static GraphicIOPack glIO;
|
||||
private static bool isGLSet = false;
|
||||
|
||||
/// <summary>
|
||||
/// Init an instance of OpenGL program,
|
||||
/// This method should be called before other
|
||||
/// graphic methods, after LoadGL method.
|
||||
/// </summary>
|
||||
public static void InitGL()
|
||||
{
|
||||
internalIO.InternalInitGL();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load OpenGL API to StgSharp core programm,
|
||||
/// please call this method before call any other
|
||||
/// graphic APIs in StgSharp.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception">If run this method twice, will throw exception</exception>
|
||||
public static unsafe void LoadGL()
|
||||
{
|
||||
GraphicIOPack GLpack = internalIO.InternalInitGraphicApi();
|
||||
if (!isGLSet)
|
||||
{
|
||||
glIO = internalIO.InternalInitGraphicApi();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Do not load GL api twice.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attach GLFW API to GLAD,
|
||||
/// this method should be called after LoadGL
|
||||
/// and before other graphic method.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception">The accident that program cannot attach GLFW to GLAD</exception>
|
||||
public static unsafe void LoadGLAD()
|
||||
{
|
||||
int a = internalIO.InternalInitGLAD();
|
||||
if (a!=0)
|
||||
{
|
||||
throw new Exception("Cannot attach GLFW to GLAD!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal static byte[] loadShaderCodeStr(string str)
|
||||
{
|
||||
byte[] cahrStr;
|
||||
@@ -21,11 +63,14 @@ namespace StgSharp
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Init a form, attach its data to GLFW program,
|
||||
/// and return the pointer of the GLFW package of the form.
|
||||
@@ -50,17 +95,10 @@ namespace StgSharp
|
||||
return a;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public static unsafe void LoadForm(Form form)
|
||||
{
|
||||
TimeLine.allForm.Add(form);
|
||||
}
|
||||
|
||||
public static unsafe bool ShouldFormClose(Form form)
|
||||
{
|
||||
int a = internalIO.InternalShouldFormClose(form.windowPtr);
|
||||
return a != 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user