示例#1
0
        public DemoHarness(GameLoop loop, ContentArchive content,
                           Controls?controls = null)
        {
            this.loop    = loop;
            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, loop.Camera, loop.Surface);

            OnResize(loop.Window.Resolution);
        }
示例#2
0
        static void Main(string[] args)
        {
            //OperatorCodegenTests.Test();
            //ConstraintDescriptionMappingTests.Test();
            //CollidablePairComparerTests.Test();
            //HeadlessDemo.Simple();
            //BatchedCollisionTests.Test();
            //TypeIdCodeGenTests.Test();
            //DeterminismTest.Test();
            //return;
            //ScalarWideTests.Test();
            //DenseFlagTests.Test();
            //VirtualOverheadTest.Test();
            //TreeTest.Test();
            //ReinterpretVectorRepro.Test();
            //TriangularTests.Test();
            //LocalsinitCodegen.Test();
            //InterlockedOverheadTests.Test();
            //LocalsinitCodegen.Test();
            //AutoTester.Test();
            //BallSocketConvergenceTests.Test();
            //MemoryResizeTests.Test();
            //DisposeTests.Test();
            //ConstraintCacheOptimizationTests.Test();
            //SortTest.Test();
            //SpanCodegenTests.Test();
            //IntertreeThreadingTests.Test();
            //return;

            //Console.ReadKey();
            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 = new MemoryStream(Resources.Content))
            {
                content = ContentArchive.Load(stream);
            }
            //var fontContent = content.Load<FontContent>(@"Content\Courier Prime Sans.ttf");
            var fontContent = content.Load <FontContent>(@"Content\Carlito-Regular.ttf");
            var font        = new Font(loop.Surface.Device, loop.Surface.Context, fontContent);
            var demo        = new DemoHarness(window, loop.Input, loop.Camera, font);

            loop.Run(demo);
            loop.Dispose();
            window.Dispose();
        }
示例#3
0
        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("Demos.Demos.contentarchive"))
            {
                content = ContentArchive.Load(stream);
            }
            var demo = new DemoHarness(loop, content);

            loop.Run(demo);
            loop.Dispose();
            window.Dispose();
        }
示例#4
0
        static void Main(string[] args)
        {
            //ConstraintDescriptionMappingTests.Test();
            //Console.ReadKey();

            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 = new MemoryStream(Resources.Content))
            {
                content = ContentArchive.Load(stream);
            }
            //var fontContent = content.Load<FontContent>(@"Content\Courier Prime Sans.ttf");
            var fontContent = content.Load <FontContent>(@"Content\Carlito-Regular.ttf");
            var font        = new Font(loop.Surface.Device, loop.Surface.Context, fontContent);
            var demo        = new DemoHarness(window, loop.Input, loop.Camera, font);

            loop.Run(demo);
            loop.Dispose();
            window.Dispose();
        }