コード例 #1
0
ファイル: TextField.cs プロジェクト: YogurtFP/YogUI
        public override void Draw(SpriteBatch sb)
        {
            if (active)
            {
                bool  defaulted = false;
                Color oldColor  = input.tdI.color;
                if (!input.selected && input.input == "" && placeHolderText != "")
                {
                    input.tdI.text  = placeHolderText;
                    defaulted       = true;
                    input.tdI.color = Color.Gray;
                }

                NinePatch patch = patchNormal;
                if (input.selected)
                {
                    if (isFilterText())
                    {
                        patch = textValid ? patchSelectedRight : patchSelectedWrong;
                    }
                    else
                    {
                        patch = patchSelected;
                    }
                }

                int patchWidth = scaleToText && input.BoundBox.Width >= (int)width ? input.BoundBox.Width : (int)width;

                patch.Draw(sb, Position, (int)patchWidth, (int)height);
                input.Position = Position + new Vector2(patch.leftWidth, patch.topHeight);
                input.Draw(sb);
                if (defaulted)
                {
                    input.tdI.text  = "";
                    input.tdI.color = oldColor;
                }

                contextMenu.Draw(sb);
            }
            base.Draw(sb);
        }
コード例 #2
0
ファイル: TextInputTest.cs プロジェクト: YogurtFP/YogUI
 public void DrawTest()
 {
     Vector2 position = new Vector2(); // TODO: Initialize to an appropriate value
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     Color color = new Color(); // TODO: Initialize to an appropriate value
     Action lambdaTextEnter = null; // TODO: Initialize to an appropriate value
     string input = string.Empty; // TODO: Initialize to an appropriate value
     Action lambdaTextChanged = null; // TODO: Initialize to an appropriate value
     TextInput target = new TextInput(position, font, color, lambdaTextEnter, input, lambdaTextChanged); // TODO: Initialize to an appropriate value
     SpriteBatch sb = null; // TODO: Initialize to an appropriate value
     target.Draw(sb);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }