daily update on 20240528 by nitload youmu

This commit is contained in:
Nitload
2024-05-28 17:45:54 +08:00
parent de399e22c2
commit 70890e3e33
88 changed files with 10678 additions and 5761 deletions
+6 -10
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Form.cs"
// file="ViewModel.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -46,7 +46,7 @@ namespace StgSharp.Graphics
/// <summary>
///
/// </summary>
public abstract unsafe partial class Form
public abstract unsafe partial class ViewModel
{
private int _frameCount;
@@ -54,20 +54,18 @@ namespace StgSharp.Graphics
private IntPtr windowID;
private short fpsCount;
internal Form sharedForm;
internal ViewModel sharedForm;
internal int height;
internal int width;
internal IntPtr monitor;
internal LinkedList<Control> allControl;
internal string name;
internal TimeSpanProvider fpsCountProvider;
internal TimeSpanProvider frameTimeProvider;
internal Vector4 backgroundColor;
protected Form((int width, int height) size, string name)
protected ViewModel((int width, int height) size, string name)
{
fpsCountProvider = new TimeSpanProvider(1.0, TimeSpanProvider.DefaultProvider);
_frameSpeed = 0;
@@ -92,7 +90,7 @@ namespace StgSharp.Graphics
this.name = name;
}
public Form()
protected ViewModel()
{
fpsCountProvider = new TimeSpanProvider(1.0, TimeSpanProvider.DefaultProvider);
_frameSpeed = 0;
@@ -102,8 +100,6 @@ namespace StgSharp.Graphics
{
Interlocked.Exchange(ref _frameSpeed, _frameCount);
Interlocked.Exchange(ref _frameCount, 0);
Console.Clear();
Console.WriteLine(_frameSpeed);
};
frameTimeProvider = new TimeSpanProvider(
(1000L * 1000L) / 60, TimeSpanProvider.DefaultProvider
@@ -218,7 +214,7 @@ namespace StgSharp.Graphics
/// <summary>
/// Set all necessary metadata to current form instance
/// </summary>
public void SetMetadata(int width, int height, string name, IntPtr monitor, Form sharedForm)
public void SetMetadata(int width, int height, string name, IntPtr monitor, ViewModel sharedForm)
{
this.width = width;
this.height = height;
@@ -41,7 +41,7 @@ using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public abstract partial class Form
public abstract partial class ViewModel
{
private Blueprint renderLogic;
@@ -64,6 +64,40 @@ namespace StgSharp.Graphics
}
}
public T BuildMainRenderStream<T>((int x, int y, int z) unitCubeSize) where T : RenderStream
{
RenderStreamConstructArgs args = new RenderStreamConstructArgs();
args.UnitCubeSize = unitCubeSize;
args.Name = this.name;
args.Height = this.Height;
args.Width = this.Width;
T? ret = Activator.CreateInstance(typeof(T), args) as T;
if (ret == null)
{
throw new InvalidOperationException("Failed in building a new RenderStream when calling AsMainStreamOf");
}
ret!.InternalInit();
this.WindowID = ret.CanvasHandle;
ret.timeProvider = this.frameTimeProvider;
return ret;
}
public T BuildNewRenderStream<T>(RenderStreamConstructArgs arg, (int x, int y, int z) unitCubeSize) where T : RenderStream
{
T? ret = Activator.CreateInstance(typeof(T), arg) as T;
if (ret == null)
{
throw new InvalidOperationException("Failed in building a new RenderStream when calling AsMainStreamOf");
}
ret!.InternalInit();
this.WindowID = ret.CanvasHandle;
ret.timeProvider = this.frameTimeProvider;
return ret;
}
/*
private void GatherSingleFrameAsyncThread(MethodInfo[] methods)
{
+4 -4
View File
@@ -11,16 +11,16 @@ namespace StgSharp.Graphics
}
public abstract unsafe partial class Form
public abstract unsafe partial class ViewModel
{
static internal Dictionary<IntPtr, Form> activatedForms ;
static internal Dictionary<IntPtr, ViewModel> activatedForms ;
public static void ShowForm<T>(FormFormatter f) where T : Form
public static void ShowForm<T>(FormFormatter f) where T : ViewModel
{
if (activatedForms == null)
{
activatedForms = new Dictionary<IntPtr, Form>();
activatedForms = new Dictionary<IntPtr, ViewModel>();
}
}