csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1005 B
41 lines
1005 B
using System;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.Rendering;
|
|
using GpuInterop.D3DDemo;
|
|
using GpuInterop.VulkanDemo;
|
|
|
|
namespace GpuInterop
|
|
{
|
|
public class MainWindow : Window
|
|
{
|
|
public MainWindow() : this(DemoType.Vulkan)
|
|
{
|
|
}
|
|
|
|
public MainWindow(DemoType demoType)
|
|
{
|
|
InitializeComponent();
|
|
|
|
Title = demoType.ToString();
|
|
|
|
Content = new GpuDemo
|
|
{
|
|
Demo = demoType switch
|
|
{
|
|
DemoType.Vulkan => new VulkanDemoControl(),
|
|
DemoType.D3D11 => new D3D11DemoControl(),
|
|
var unknown => throw new InvalidOperationException($"Unknown demo type {unknown}")
|
|
}
|
|
};
|
|
|
|
RendererDiagnostics.DebugOverlays = RendererDebugOverlays.Fps;
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
}
|
|
}
|
|
|