Example #1
0
 public void ButtonConstructorTest()
 {
     Vector2 Position = new Vector2(); // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     Action lambdaOnClick = null; // TODO: Initialize to an appropriate value
     Button target = new Button(Position, text, font, lambdaOnClick);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Example #2
0
 public void DrawTest()
 {
     Vector2 Position = new Vector2(); // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     Action lambdaOnClick = null; // TODO: Initialize to an appropriate value
     Button target = new Button(Position, text, font, lambdaOnClick); // 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.");
 }
Example #3
0
 public void BoundBoxTest()
 {
     Vector2 Position = new Vector2(); // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     Action lambdaOnClick = null; // TODO: Initialize to an appropriate value
     Button target = new Button(Position, text, font, lambdaOnClick); // TODO: Initialize to an appropriate value
     Rectangle actual;
     actual = target.BoundBox;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #4
0
 public void GetTotalHeightTest()
 {
     Vector2 Position = new Vector2(); // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     Action lambdaOnClick = null; // TODO: Initialize to an appropriate value
     Button target = new Button(Position, text, font, lambdaOnClick); // TODO: Initialize to an appropriate value
     float expected = 0F; // TODO: Initialize to an appropriate value
     float actual;
     actual = target.GetTotalHeight();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #5
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     YogUI.YogUI_LoadContent(this);
     SpriteFont buttonFont = Content.Load<SpriteFont>("buttonFont");
     createNewNinepatch = new Button(new Vector2(200, 100), "Create new Ninepatch", buttonFont, createNew);
     loadExistingNinepatch = new Button(new Vector2(200, 150), "Load existing Ninepatch", buttonFont, loadExisting);
     // TODO: use this.Content to load your game content here
 }
Example #6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            YogUI.YogUI_LoadContent(this);

            SpriteFont buttonFont = Content.Load<SpriteFont>("buttonFont");

            loadNinepatch = new Button(new Vector2(46, 23), "Open", buttonFont, loadExisting);
            saveNinepatchAs = new Button(new Vector2(150, 23), "Save", buttonFont, saveImage);

            xStart = new TextField(new Vector2(225, 3), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            xEnd = new TextField(new Vector2(225, 28), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            xStart.stringPattern = xEnd.stringPattern = "^\\d+?$";
            xStart.placeHolderText = "X start";
            xEnd.placeHolderText = "X end";

            yStart = new TextField(new Vector2(305, 3), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            yEnd = new TextField(new Vector2(305, 28), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            yStart.stringPattern = yEnd.stringPattern = "^\\d+?$";
            yStart.placeHolderText = "Y start";
            yEnd.placeHolderText = "Y end";

            refreshNinepatch = new Button(new Vector2(420, 18), "Refresh", buttonFont, refresh);

            patchScale = new SliderBar(new Vector2(465, 9), 225, 30, 0, 100, buttonFont);

            drawContent = new CheckBox(new Vector2(390, 45), buttonFont);
            drawContent.SetLabel("Draw content");
            drawContent.SetChecked(true);

            scaleX = new RadioButton(new Vector2(700, 9), buttonFont, "Scale X");
            scaleY = new RadioButton(new Vector2(700, 23), buttonFont, "Scale Y");
            scaleXY = new RadioButton(new Vector2(700, 37), buttonFont, "Scale X+Y");

            scaleGroup.addButton(scaleX);
            scaleGroup.addButton(scaleY);
            scaleGroup.addButton(scaleXY);

            scaleX.selected = true;

            // TODO: use this.Content to load your game content here
        }
Example #7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            YogUILibrary.YogUI.YogUI_LoadContent(this);
            font = Content.Load<SpriteFont>("Console");

            //Create a new Text Field with position (top-left) at 0, 10. Width 100, height 20 (don't change this to anything else yet),
            //White text, Black background, White border, SpriteFont font, doing nothing on text enter, and nothing on text changed.
            textField = new TextField(new Vector2(0, 10), 200, 20, Color.Black, font, (string s) => { /*Pressed Enter*/ }, (string s) => { /*Text changed*/});
            textField.SetText("TextField");
            textField.placeHolderText = "Default text";
            textField.scaleToText = true;

            filterTextField = new TextField(new Vector2(330, 10), 150, 20, Color.Black, font, (string s) => { });
            filterTextField.stringPattern = "^\\d+?\\.\\d+?\\.\\d+?\\.\\d+?$";
            //Create a new ListBox at (0, 150), 90 width, 100 height, and doing nothing on Selected Index Changed.
            listBox = new ListBox(new Vector2(0, 150), 90, 100, font, () => { /*Selected Index Changed*/});
            listBox.dataSource = new string[] { "Index 1", "Index 2", "Index 3" }.ToList<string>();

            //Create a new ProgressBar at (150, 100), 100 width, 30 height, 50% progress.
            progressBar = new ProgressBar(new Vector2(150, 100), 100, 30, 50f);

            //Create a new sliderbar at (150, 150), 100 width, 30 height, 0 minimum value, 200 maximum value, SpriteFont font, 25% progress.
            sliderBar = new SliderBar(new Vector2(150, 150), 100, 30, 0, 200, font, 25);

            //Create two new radiobuttons
            radioButton1 = new RadioButton(new Vector2(200, 50), font, "RadioButton 1");
            radioButton2 = new RadioButton(new Vector2(200, 65), font, "Radiobutton 2");

            //Add the radiobuttons to a RadioButtonGroup that controls only one being "checked" at a time.
            radioButtonGroup.addButton(radioButton1);
            radioButtonGroup.addButton(radioButton2);

            //Create a new CheckBox at (200, 90), SpriteFont font.
            checkBox = new CheckBox(new Vector2(200, 90), font);

            //Create a new ComboBox at (500, 200), SpriteFont font.
            comboBox = new ComboBox(new Vector2(500, 200), font, "Combo box option 1", "Combo box option 2", "Combo box option 3");

            //Create a new button at (500, 100), with the text "Button", Adding a new item to the listbox when it is clicked, the text being from the TextField.
            button = new Button(new Vector2(500, 100), "Button", font, () => { listBox.dataSource.Add(textField.GetText()); });
            //   button.paddingHeight = 10;
            // button.paddingWidth = 200;
        }