/// <summary> /// Creates a new instance of Console /// </summary> /// <param name="game">The XNA Game with which to register the /// Console component and IConsole service</param> /// <param name="font">The path to the SpriteFont used to draw /// text to the console</param> /// <param name="textColor">The color of the console text</param> /// <param name="bgColor">The color of the console background</param> /// <param name="bgAlpha">The alpha translucency of the console background</param> /// <param name="lineCount">The maximum number of text lines visible in /// the console at any given time</param> internal GameConsole(Game game, string font, Color textColor, Color bgColor, float bgAlpha, int lineCount) : base(game) { mFontName = font; mDefaultTextColor = textColor; mBackgroundColor = bgColor; mBackgroundAlpha = MathHelper.Clamp(bgAlpha, 0f, 1f); mVisibleLineCount = (lineCount < 1) ? (1) : (lineCount); mVerticalSpacing = 5f; mHorizontalPadding = 5f; mDisplayOptions = ConsoleDisplayOptions.None; mTimestampFormat = "{Hr}:{Min}:{Sec}"; mCharSizeLut = new Dictionary <char, Vector2>(); mTextColors = new Dictionary <uint, Color>(); mCommandHandlers = new Dictionary <string, ConsoleCommandHandlerInfo>(); mLog = new List <ConsoleMessage>(); mCurrentText = new StringBuilder(); mInputPrompt = ">"; // echo enabled by default mEchoEnabled = true; mEchoLogLevel = 0; mDefaultLogLevel = 0; // log and display all by default mLogLevelThreshold = -1; mDisplayLevelThreshold = -1; // cursor enabled by default mCursorEnabled = true; mCursorBlinkSpeed = 0.25f; mNotifyBlinkSpeed = 0.25f; mAutoScrollOnOutput = true; mAlertOnUnrecognizedCommand = true; mDrawCursor = false; mDrawNotify = false; mCursorTimer = mCursorBlinkSpeed; mNotifyTimer = mNotifyBlinkSpeed; mCurrentTime = new GameTime(); mCloseKey = Keys.OemTilde; isEnabled = false; }
/// <summary> /// Creates a new instance of Console /// </summary> /// <param name="game">The XNA Game with which to register the /// Console component and IConsole service</param> /// <param name="font">The path to the SpriteFont used to draw /// text to the console</param> /// <param name="textColor">The color of the console text</param> /// <param name="bgColor">The color of the console background</param> /// <param name="bgAlpha">The alpha translucency of the console background</param> /// <param name="lineCount">The maximum number of text lines visible in /// the console at any given time</param> internal GameConsole(Game game, string font, Color textColor, Color bgColor, float bgAlpha, int lineCount) : base(game) { mFontName = font; mDefaultTextColor = textColor; mBackgroundColor = bgColor; mBackgroundAlpha = MathHelper.Clamp(bgAlpha, 0f, 1f); mVisibleLineCount = (lineCount < 1) ? (1) : (lineCount); mVerticalSpacing = 5f; mHorizontalPadding = 5f; mDisplayOptions = ConsoleDisplayOptions.None; mTimestampFormat = "{Hr}:{Min}:{Sec}"; mCharSizeLut = new Dictionary<char, Vector2>(); mTextColors = new Dictionary<uint, Color>(); mCommandHandlers = new Dictionary<string, ConsoleCommandHandlerInfo>(); mLog = new List<ConsoleMessage>(); mCurrentText = new StringBuilder(); mInputPrompt = ">"; // echo enabled by default mEchoEnabled = true; mEchoLogLevel = 0; mDefaultLogLevel = 0; // log and display all by default mLogLevelThreshold = -1; mDisplayLevelThreshold = -1; // cursor enabled by default mCursorEnabled = true; mCursorBlinkSpeed = 0.25f; mNotifyBlinkSpeed = 0.25f; mAutoScrollOnOutput = true; mAlertOnUnrecognizedCommand = true; mDrawCursor = false; mDrawNotify = false; mCursorTimer = mCursorBlinkSpeed; mNotifyTimer = mNotifyBlinkSpeed; mCurrentTime = new GameTime(); mCloseKey = Keys.OemTilde; isEnabled = false; }