daily update on 20230609 by nitload youmu, graphic arragement for better form init

This commit is contained in:
Nitload
2023-06-09 08:12:06 +08:00
parent 1874b32fb0
commit 50b4965e54
147 changed files with 8886 additions and 478 deletions
+31 -12
View File
@@ -1,28 +1,47 @@
using StgSharp.Control;
using StgSharp.Graphics;
using StgSharp.Graphics.GL;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp
{
public static class Graphic
public static unsafe class Graphic
{
private const string glPackageName = "StgSharpGraphics.dll";
//private static GraphicIO glIO;
static Graphic()
/// <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)
{
//glIO = InitPackage();
//initWindow = glIO.initWindowPtr;
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)
{
ProgramTimeLine.allForm.Add(form);
}
public static InitWindow initWindow ;
/*
[DllImport(glPackageName, EntryPoint = "initPackage")]
internal static extern GraphicIO InitPackage();
/**/
}
}