using System;
using ComputeSharp.Sample.SwapChain.Backend;
using ComputeSharp.Sample.SwapChain.Shaders;
namespace ComputeSharp.Sample.SwapChain
{
class Program
{
///
/// The mapping of available samples to choose from.
///
private static readonly Win32Application[] Samples = new Win32Application[]
{
new SwapChainApplication(static (texture, time) => new(texture, (float)time.TotalSeconds)),
new SwapChainApplication(static (texture, time) => new(texture, (float)time.TotalSeconds)),
new SwapChainApplication(static (texture, time) => new(texture, (float)time.TotalSeconds)),
new SwapChainApplication(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]);
}
}
}