-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
73 lines (65 loc) · 1.94 KB
/
Program.cs
File metadata and controls
73 lines (65 loc) · 1.94 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
66
67
68
69
70
71
72
73
using System;
using Raylib_cs;
namespace Examples;
public class ExampleInfo(string name, Func<int> main)
{
public string Name { get; set; } = name;
public Func<int> Main { get; set; } = main;
}
public static class ExampleList
{
public static readonly ExampleInfo[] AllExamples =
[
new("Basic", Basic.Main),
new("Probe", Probe.Main),
new("Lights", Lights.Main),
new("Pbr", Pbr.Main),
new("Transparency", Transparency.Main),
new("Skybox", Skybox.Main),
new("Sponza", Sponza.Main),
new("Sprite", Sprite.Main),
new("Animation", Animation.Main),
new("Bloom", Bloom.Main),
new("Resize", Resize.Main),
new("Shader", Shader.Main),
new("Kinematics", Kinematics.Main),
new("Particles", Particles.Main),
new("Instanced", Instanced.Main),
new("Billboards", Billboards.Main),
new("Sun", Sun.Main),
new("Dof", Dof.Main),
new("Decal", Decal.Main),
new("CustomMesh", CustomMesh.Main),
new("AnimTree", AnimTree.Main)
];
public static ExampleInfo? GetExample(string name)
{
var example = Array.Find(AllExamples, x =>
x.Name.Equals(name, StringComparison.OrdinalIgnoreCase)
);
return example;
}
}
internal static class Program
{
private static unsafe void Main(string[] args)
{
Raylib.SetTraceLogCallback(&Logging.LogConsole);
if (args.Length > 0)
{
var example = ExampleList.GetExample(args[0]);
example?.Main.Invoke();
}
else
RunExamples(ExampleList.AllExamples);
}
private static void RunExamples(ExampleInfo[] examples)
{
var configFlags = Enum.GetValues<ConfigFlags>();
foreach (var example in examples)
{
example.Main.Invoke();
foreach (var flag in configFlags) Raylib.ClearWindowState(flag);
}
}
}