public TextInputWidget( Game game, Font font )
            : base(game)
        {
            HorizontalAnchor = Anchor.LeftOrTop;
            VerticalAnchor = Anchor.BottomOrRight;
            typingLogPos = game.Chat.InputLog.Count; // Index of newest entry + 1.
            buffer = new WrappableStringBuffer( 64 * lines );

            DrawTextArgs args = new DrawTextArgs( "_", font, true );
            caretTex = game.Drawer2D.MakeChatTextTexture( ref args, 0, 0 );
            caretTex.Width = (caretTex.Width * 3) / 4;
            defaultCaretWidth = caretTex.Width;

            args = new DrawTextArgs( "> ", font, true );
            Size defSize = game.Drawer2D.MeasureChatSize( ref args );
            defaultWidth = Width = defSize.Width;
            defaultHeight = Height = defSize.Height;

            this.font = font;
            altText = new AltTextInputWidget( game, font, this );
            altText.Init();
        }
        public TextInputWidget(Game game, Font font) : base(game)
        {
            HorizontalAnchor = Anchor.LeftOrTop;
            VerticalAnchor   = Anchor.BottomOrRight;
            typingLogPos     = game.Chat.InputLog.Count;         // Index of newest entry + 1.
            buffer           = new WrappableStringBuffer(64 * lines);

            DrawTextArgs args = new DrawTextArgs("_", font, true);

            caretTex          = game.Drawer2D.MakeChatTextTexture(ref args, 0, 0);
            caretTex.Width    = (caretTex.Width * 3) / 4;
            defaultCaretWidth = caretTex.Width;

            args = new DrawTextArgs("> ", font, true);
            Size defSize = game.Drawer2D.MeasureChatSize(ref args);

            defaultWidth  = Width = defSize.Width;
            defaultHeight = Height = defSize.Height;

            this.font = font;
            altText   = new AltTextInputWidget(game, font, this);
            altText.Init();
        }
Example #3
0
        public InputWidget(Game game, Font font) : base(game)
        {
            Text      = new WrappableStringBuffer(Utils.StringLength * MaxLines);
            lines     = new string[MaxLines];
            lineSizes = new Size[MaxLines];

            DrawTextArgs args = new DrawTextArgs("_", font, true);

            caretTex       = game.Drawer2D.MakeTextTexture(ref args, 0, 0);
            caretTex.Width = (short)((caretTex.Width * 3) / 4);
            caretWidth     = caretTex.Width; caretHeight = caretTex.Height;
            this.font      = font;

            if (Prefix == null)
            {
                return;
            }
            args = new DrawTextArgs(Prefix, font, true);
            Size size = game.Drawer2D.MeasureSize(ref args);

            prefixWidth  = Width = size.Width;
            prefixHeight = Height = size.Height;
        }