-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cac8e80
commit 0d08372
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>_2_Instance</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Comman\Comman.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Silk.NET.WebGPU; | ||
using Silk.NET.Windowing; | ||
|
||
namespace _2_Instance | ||
{ | ||
internal unsafe class Program | ||
{ | ||
private static IWindow _window; | ||
|
||
|
||
private static WebGPU _wgpu; | ||
private static Instance* _instance; | ||
static void Main(string[] args) | ||
{ | ||
_window = Window.Create(WindowOptions.Default with{ | ||
API = GraphicsAPI.None, | ||
WindowBorder = WindowBorder.Fixed | ||
}); | ||
|
||
_window.Initialize(); | ||
_window.Center(); | ||
_window.Load += WindowLoad; | ||
_window.Render += WindowRender; | ||
_window.Update += WindowOnUpdate; | ||
_window.Closing += WindowClosing; | ||
|
||
_window.Run(); | ||
} | ||
private static void WindowLoad() | ||
{ | ||
_wgpu = WebGPU.GetApi(); | ||
_instance = _wgpu.CreateInstance(new InstanceDescriptor()); | ||
if (_instance is null) | ||
throw new Exception("instance init failure"); | ||
|
||
|
||
} | ||
|
||
private static void WindowOnUpdate(double obj) | ||
{ | ||
Console.WriteLine("WindowOnUpdate"); | ||
} | ||
|
||
|
||
|
||
private static void WindowRender(double obj) | ||
{ | ||
Console.WriteLine("window_Render"); | ||
} | ||
|
||
private static void WindowClosing() | ||
{ | ||
_wgpu.InstanceRelease(_instance); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters