Added sample selection

このコミットが含まれているのは:
Sergio Pedri committed 2021-02-23 03:28:12 +01:00
1 親 be3216313c
コミット f778abd941
1ファイル変更
+35 -3
+35 -3
ファイルの表示
@@ -1,13 +1,45 @@
using ComputeSharp.Sample.SwapChain.Backend;
using System;
using ComputeSharp.Sample.SwapChain.Backend;
using ComputeSharp.Sample.SwapChain.Shaders;
namespace ComputeSharp.Sample.SwapChain
{
class Program
{
static void Main(string[] args)
/// <summary>
/// The mapping of available samples to choose from.
/// </summary>
private static readonly Win32Application[] Samples = new Win32Application[]
{
Win32ApplicationRunner.Run(new SwapChainApplication<ColorfulInfinity>(static (texture, time) => new(texture, (float)time.TotalSeconds)));
new SwapChainApplication<ColorfulInfinity>(static (texture, time) => new(texture, (float)time.TotalSeconds)),
new SwapChainApplication<FractalTiling>(static (texture, time) => new(texture, (float)time.TotalSeconds)),
new SwapChainApplication<TwoTiledTruchet>(static (texture, time) => new(texture, (float)time.TotalSeconds))
};
static void Main()
{
Console.WriteLine("Available samples:");
Console.WriteLine();
for (int i = 0; i < Samples.Length; i++)
{
Console.WriteLine($"{i}: {Samples[i].GetType().GenericTypeArguments[0].Name}");
}
Console.WriteLine();
int index;
do
{
Console.Write("Enter the index of the sample to run: ");
}
while (!int.TryParse(Console.ReadLine(), out index));
Console.WriteLine();
Console.WriteLine($"Starting {Samples[index].GetType().GenericTypeArguments[0].Name}...");
Win32ApplicationRunner.Run(Samples[index]);
}
}
}