Esempio n. 1
0
 private void OnResize(Int2 resolution)
 {
     //We just don't support true fullscreen in the demos. Would be pretty pointless.
     Renderer.Surface.Resize(resolution, false);
     Camera.AspectRatio = resolution.X / (float)resolution.Y;
     DemoHarness?.OnResize(resolution);
 }
Esempio n. 2
0
 void Update(float dt)
 {
     Input.Start();
     if (DemoHarness != null)
     {
         //We'll let the delegate's logic handle the variable time steps.
         DemoHarness.Update(dt);
         //At the moment, rendering just follows sequentially. Later on we might want to distinguish it a bit more with fixed time stepping or something. Maybe.
         DemoHarness.Render(Renderer);
     }
     Renderer.Render(Camera);
     Surface.Present();
     Input.End();
 }
Esempio n. 3
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();
        }
Esempio n. 4
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();
        }
Esempio n. 5
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();
        }
Esempio n. 6
0
 public void Run(DemoHarness harness)
 {
     DemoHarness = harness;
     Window.Run(Update, OnResize);
 }