Repository navigation
Expand file tree
/
Copy pathApplication.cs
More file actions
65 lines (52 loc) · 1.73 KB
/
Copy pathApplication.cs
File metadata and controls
65 lines (52 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using ImGui4NET;
namespace ImGui4NET.Template.MultiPlatforms;
internal sealed class SimpleApplication : IApplication
{
private static readonly bool EnableTriangle = false;
private GlTriangle? _glTriangle;
private VulkanTriangle? _vulkanTriangle;
public void Create() { }
public void Resize(int width, int height) { }
public void GraphicsCreated(in GraphicsContext context)
{
if (!EnableTriangle)
return;
if (context.Vulkan is { } device)
_vulkanTriangle = new VulkanTriangle(device);
else
_glTriangle = new GlTriangle(context);
}
public void GraphicsDisposing(in GraphicsContext context)
{
_glTriangle?.Dispose();
_glTriangle = null;
_vulkanTriangle?.Dispose();
_vulkanTriangle = null;
}
public RenderOptions BeginRender()
{
ImGui.NewFrame();
return new RenderOptions(ClearColor: true);
}
public void Render(double deltaSeconds) => ImGui.ShowDemoWindow();
public unsafe ImDrawData* EndRender()
{
ImGui.Render();
return ImGui.GetDrawData();
}
public void DrawBeforeImGui(in RenderFrameContext context)
{
_glTriangle?.Draw();
_vulkanTriangle?.Draw(context);
}
public void DrawAfterImGui(in RenderFrameContext context) { }
public void KeyDown(ImGuiKey key) { }
public void KeyUp(ImGuiKey key) { }
public void TextInput(uint codepoint) { }
public void PointerDown(int button, float x, float y) { }
public void PointerMove(float x, float y) { }
public void PointerUp(int button, float x, float y) { }
public void PointerCancel() { }
public void Scroll(float x, float y) { }
public void Dispose() { }
}