67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
using StgSharp.Control;
|
|
using StgSharp.Graphics;
|
|
using System;
|
|
|
|
namespace StgSharp
|
|
{
|
|
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.
|
|
/// </summary>
|
|
/// <param name="form">The C# instance of the form</param>
|
|
/// <returns>Pointer of the GLFW package of this form</returns>
|
|
/// <exception cref="Exception">The issue that form is not successfully initilized
|
|
/// or GLAD program fail to init</exception>
|
|
public static unsafe IntPtr InitWindow(Form form)
|
|
{
|
|
IntPtr a = internalIO.InternalInitWindow(form.info);
|
|
if ((long)a == -1)
|
|
{
|
|
throw new Exception("Failed to init form.");
|
|
}
|
|
else if ((long)a == -2)
|
|
{
|
|
throw new Exception("Failed to load GLAD program.");
|
|
}
|
|
else
|
|
{
|
|
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;
|
|
}
|
|
|
|
}
|
|
}
|