static void Main(string[] args) { var window = new Window("pretty cool multicolored window", new Int2((int)(DisplayDevice.Default.Width * 0.75f), (int)(DisplayDevice.Default.Height * 0.75f)), WindowMode.Windowed); var loop = new GameLoop(window); ContentArchive content; using (var stream = typeof(Program).Assembly.GetManifestResourceStream("bepuphysics2_for_nelalen.Demos.contentarchive")) { content = ContentArchive.Load(stream); } var demo = new DemoHarness(loop, content); loop.Run(demo); loop.Dispose(); window.Dispose(); }
internal DemoHarness(GameLoop loop, ContentArchive content, Controls?controls = null) { this.window = loop.Window; this.input = loop.Input; this.camera = loop.Camera; this.content = content; timeSamples = new SimulationTimeSamples(512, loop.Pool); if (controls == null) { this.controls = Controls.Default; } var fontContent = content.Load <FontContent>(@"Content\Carlito-Regular.ttf"); font = new Font(loop.Surface.Device, loop.Surface.Context, fontContent); timingGraph = new Graph(new GraphDescription { BodyLineColor = new Vector3(1, 1, 1), AxisLabelHeight = 16, AxisLineRadius = 0.5f, HorizontalAxisLabel = "Frames", VerticalAxisLabel = "Time (ms)", VerticalIntervalValueScale = 1e3f, VerticalIntervalLabelRounding = 2, BackgroundLineRadius = 0.125f, IntervalTextHeight = 12, IntervalTickRadius = 0.25f, IntervalTickLength = 6f, TargetHorizontalTickCount = 5, HorizontalTickTextPadding = 0, VerticalTickTextPadding = 3, LegendMinimum = new Vector2(20, 200), LegendNameHeight = 12, LegendLineLength = 7, TextColor = new Vector3(1, 1, 1), Font = font, LineSpacingMultiplier = 1f, ForceVerticalAxisMinimumToZero = true }); timingGraph.AddSeries("Total", new Vector3(1, 1, 1), 0.75f, timeSamples.Simulation); timingGraph.AddSeries("Pose Integrator", new Vector3(0, 0, 1), 0.25f, timeSamples.PoseIntegrator); timingGraph.AddSeries("Sleeper", new Vector3(0.5f, 0, 1), 0.25f, timeSamples.Sleeper); timingGraph.AddSeries("Broad Update", new Vector3(1, 1, 0), 0.25f, timeSamples.BroadPhaseUpdate); timingGraph.AddSeries("Collision Test", new Vector3(0, 1, 0), 0.25f, timeSamples.CollisionTesting); timingGraph.AddSeries("Narrow Flush", new Vector3(1, 0, 1), 0.25f, timeSamples.NarrowPhaseFlush); timingGraph.AddSeries("Solver", new Vector3(1, 0, 0), 0.5f, timeSamples.Solver); timingGraph.AddSeries("Body Opt", new Vector3(1, 0.5f, 0), 0.125f, timeSamples.BodyOptimizer); timingGraph.AddSeries("Constraint Opt", new Vector3(0, 0.5f, 1), 0.125f, timeSamples.ConstraintOptimizer); timingGraph.AddSeries("Batch Compress", new Vector3(0, 0.5f, 0), 0.125f, timeSamples.BatchCompressor); //demoSet = new DemoSet(); //demo = demoSet.Build(0, content, camera); demo = new Bepu(); demo.Initialize(content, camera); OnResize(window.Resolution); }