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;
}
}
///
/// Init a form, attach its data to GLFW program,
/// and return the pointer of the GLFW package of the form.
///
/// The C# instance of the form
/// Pointer of the GLFW package of this form
/// The issue that form is not successfully initilized
/// or GLAD program fail to init
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;
}
}
}