void Restart() { entry = TestEntries.g_testEntries[testIndex]; test = entry.createFcn(); Resize(width, height); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { et.BeginTrace(TraceEvents.DrawEventId); GraphicsDevice.Clear(Color.Black); basicEffect.Techniques[0].Passes[0].Apply(); test.SetTextLine(30); settings.hz = settingsHz; et.BeginTrace(TraceEvents.PhysicsEventId); test.Step(settings); et.EndTrace(TraceEvents.PhysicsEventId); test.DrawTitle(50, 15, entry.name); if (testSelection != testIndex) { testIndex = testSelection; entry = TestEntries.g_testEntries[testIndex]; test = entry.createFcn(); viewZoom = 1.0f; viewCenter = new Vector2(0.0f, 20.0f); Resize(width, height); } test._debugDraw.FinishDrawShapes(); if (test != null) { spriteBatch.Begin(); test._debugDraw.FinishDrawString(); spriteBatch.End(); } base.Draw(gameTime); et.EndTrace(TraceEvents.DrawEventId); et.EndTrace(TraceEvents.FrameEventId); et.ResetFrame(); et.BeginTrace(TraceEvents.FrameEventId); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); et = new EventTrace(this); TraceEvents.Register(et); testCount = 0; while (TestEntries.g_testEntries[testCount].createFcn != null) { ++testCount; } testIndex = MathUtils.Clamp(testIndex, 0, testCount - 1); testSelection = testIndex; entry = TestEntries.g_testEntries[testIndex]; test = entry.createFcn(); }