/// <param name="args">Arguments passed from Debug.Assert.</param> public AssertScreen(DebugEventArgs args) : base() { assertText = new List <AssertText>(); int width = VolumetricRenderer.Game.GraphicsDevice.PresentationParameters.BackBufferWidth; SpriteFontEx fontEx = VolumetricRenderer.Game.ScreenManager.DefaultFontEx; // Set up all the text to be drawn. float yPos = 0; PlaceAssertText("ASSERT:", ref yPos, ref fontEx, width); if (args.Messages.Length > 0) { for (int i = 0; i < args.Messages.Length; ++i) { PlaceAssertText(args.Messages[i], ref yPos, ref fontEx, width); yPos += fontEx.font.LineSpacing; } } else { PlaceAssertText("(no info)", ref yPos, ref fontEx, width); yPos += fontEx.font.LineSpacing; } PlaceAssertText("IN:", ref yPos, ref fontEx, width); PlaceAssertText(args.MethodName, ref yPos, ref fontEx, width); PlaceAssertText(args.FileName + ": line " + args.LineNumber, ref yPos, ref fontEx, width); yPos += fontEx.font.LineSpacing * 2; PlaceAssertText("Press Enter to quit...", ref yPos, ref fontEx, width); // Shift all the text down a bit so it's not right at the top of the screen. int height = VolumetricRenderer.Game.GraphicsDevice.PresentationParameters.BackBufferHeight; int yOffset = (height - (fontEx.font.LineSpacing * (assertText.Count + 4))) / 3; if (yOffset < 5) { yOffset = 5; } for (int i = 0; i < assertText.Count; ++i) { AssertText at = assertText[i]; at.position.Y += yOffset; assertText[i] = at; } // Set up the flashing text parameters. flashColor = Color.White; flashRate = TimeSpan.FromMilliseconds(700); flashDir = -1; }
/// <inheritdoc cref="Called(AssertObject,object,Times)"/> public static AssertChainer <AssertText> Called(this AssertText asserter, object fake, Times total = null) { VerifyAllCalls(fake, total); return(asserter?.ToChainer()); }