diff --git a/samples/ComputeSharp.Sample.SwapChain/Program.cs b/samples/ComputeSharp.Sample.SwapChain/Program.cs index f28ae939..98d036cd 100644 --- a/samples/ComputeSharp.Sample.SwapChain/Program.cs +++ b/samples/ComputeSharp.Sample.SwapChain/Program.cs @@ -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) + /// + /// The mapping of available samples to choose from. + /// + private static readonly Win32Application[] Samples = new Win32Application[] { - Win32ApplicationRunner.Run(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]); } } }