コード例 #1
0
ファイル: RadioButton.cs プロジェクト: YogurtFP/YogUI
 public RadioButton(Vector2 position, SpriteFont font, string text = "RadioButton")
 {
     labelText = text;
     label = new TextDrawer(font, labelText, position + new Vector2(radius + 5,  -radius * 2), Color.White);
     Position = position;
     base.UIC_Initialize();
 }
コード例 #2
0
 public RadioButton(Vector2 position, SpriteFont font, string text = "RadioButton")
 {
     labelText = text;
     label     = new TextDrawer(font, labelText, position + new Vector2(radius + 5, -radius * 2), Color.White);
     Position  = position;
     base.UIC_Initialize();
 }
コード例 #3
0
ファイル: SliderBar.cs プロジェクト: YogurtFP/YogUI
        public SliderBar(Vector2 position, float width, float height, int min, int max, SpriteFont font, float progress = 0.0f)
        {
            this.width = width;
            this.height = height;
            this.min = min;
            this.max = max;
            progressBar = new ProgressBar(position, width, height, progress);
            Vector2 center = new Vector2((int)(position.X + (width / 2)), (int)(position.Y + (height / 2)));
            progressText = new TextDrawer(font, "", center, Color.White, TextAlign.Center);

            InputManager.BindMouse(() => {
                Point mousePoint = InputManager.GetMousePos();
                Vector2 mouseVector = new Vector2(mousePoint.X, mousePoint.Y);
                if ((progressBar.BoundBox.Contains(mousePoint) || selected) && !selectedOutside)
                {
                    int dist = (int)(mousePoint.X - progressBar.BoundBox.Left);
                    float p = (dist / progressBar.width) * 100;
                    p = (p > 0) ? (p < 100) ? p : 100 : 0;
                    progressBar.setProgress(p);
                    selected = true;
                }
                else
                {
                    selectedOutside = true;
                }
            }, MouseButton.Left, true, true);
            InputManager.BindMouse(() =>
            {
                selected = false;
                selectedOutside = false;
            }, MouseButton.Left, false);
        }
コード例 #4
0
ファイル: SliderBar.cs プロジェクト: YogurtFP/YogUI
        public SliderBar(Vector2 position, float width, float height, int min, int max, SpriteFont font, float progress = 0.0f)
        {
            this.width  = width;
            this.height = height;
            this.min    = min;
            this.max    = max;
            progressBar = new ProgressBar(position, width, height, progress);
            Vector2 center = new Vector2((int)(position.X + (width / 2)), (int)(position.Y + (height / 2)));

            progressText = new TextDrawer(font, "", center, Color.White, TextAlign.Center);

            InputManager.BindMouse(() => {
                Point mousePoint    = InputManager.GetMousePos();
                Vector2 mouseVector = new Vector2(mousePoint.X, mousePoint.Y);
                if ((progressBar.BoundBox.Contains(mousePoint) || selected) && !selectedOutside)
                {
                    int dist = (int)(mousePoint.X - progressBar.BoundBox.Left);
                    float p  = (dist / progressBar.width) * 100;
                    p        = (p > 0) ? (p < 100) ? p : 100 : 0;
                    progressBar.setProgress(p);
                    selected = true;
                }
                else
                {
                    selectedOutside = true;
                }
            }, MouseButton.Left, true, true);
            InputManager.BindMouse(() =>
            {
                selected        = false;
                selectedOutside = false;
            }, MouseButton.Left, false);
        }
コード例 #5
0
ファイル: CheckBox.cs プロジェクト: YogurtFP/YogUI
 public CheckBox(Vector2 position, SpriteFont font)
 {
     Position = position;
     Vector2 textPosition = new Vector2(position.X + 10, position.Y - (height));
     labelDrawer = new TextDrawer(font, label, textPosition, labelColor);
     base.UIC_Initialize();
 }
コード例 #6
0
ファイル: TextClickable.cs プロジェクト: YogurtFP/YogUI
 public TextClickable(Vector2 position, string text, SpriteFont font, Color c, Color cHover, Action onClick)
 {
     tdI = new TextDrawer(font, text, position, c, TextAlign.Left);
     this.color = c;
     this.cHover = cHover;
     this.onClick = onClick;
     base.UIC_Initialize();
 }
コード例 #7
0
 public TextClickable(Vector2 position, string text, SpriteFont font, Color c, Color cHover, Action onClick)
 {
     tdI          = new TextDrawer(font, text, position, c, TextAlign.Left);
     this.color   = c;
     this.cHover  = cHover;
     this.onClick = onClick;
     base.UIC_Initialize();
 }
コード例 #8
0
        public CheckBox(Vector2 position, SpriteFont font)
        {
            Position = position;
            Vector2 textPosition = new Vector2(position.X + 10, position.Y - (height));

            labelDrawer = new TextDrawer(font, label, textPosition, labelColor);
            base.UIC_Initialize();
        }
コード例 #9
0
ファイル: TextInput.cs プロジェクト: YogurtFP/YogUI
 public TextInput(Vector2 position, SpriteFont font, Color color, Action lambdaTextEnter, string input = "", Action lambdaTextChanged = null)
 {
     this.input = input;
     this.lambdaTextEnter = lambdaTextEnter;
     this.lambdaTextChanged = lambdaTextChanged;
     tdI = new TextDrawer(font, input, position, color, TextAlign.Left);
     this.bindKeys();
     base.UIC_Initialize();
 }
コード例 #10
0
 public TextInput(Vector2 position, SpriteFont font, Color color, Action lambdaTextEnter, string input = "", Action lambdaTextChanged = null)
 {
     this.input             = input;
     this.lambdaTextEnter   = lambdaTextEnter;
     this.lambdaTextChanged = lambdaTextChanged;
     tdI = new TextDrawer(font, input, position, color, TextAlign.Left);
     this.bindKeys();
     base.UIC_Initialize();
 }
コード例 #11
0
 public Button(Vector2 Position, string text, SpriteFont font, Action lambdaOnClick = null)
 {
     this.Position = Position;
     base.UIC_Initialize();
     this.lambdaOnClick = lambdaOnClick;
     td          = new TextDrawer(font, text, Position, textColor, TextAlign.Center);
     patchNormal = YogUI.btn_normal;
     patchHover  = YogUI.btn_hover;
     patchClick  = YogUI.btn_hover;
 }
コード例 #12
0
ファイル: Button.cs プロジェクト: YogurtFP/YogUI
 public Button(Vector2 Position, string text, SpriteFont font, Action lambdaOnClick = null)
 {
     this.Position = Position;
     base.UIC_Initialize();
     this.lambdaOnClick = lambdaOnClick;
     td = new TextDrawer(font, text, Position, textColor, TextAlign.Center);
     patchNormal = YogUI.btn_normal;
     patchHover = YogUI.btn_hover;
     patchClick = YogUI.btn_hover;
 }
コード例 #13
0
ファイル: TextDrawerTest.cs プロジェクト: YogurtFP/YogUI
 public void BoundBoxTest()
 {
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     Vector2 position = new Vector2(); // TODO: Initialize to an appropriate value
     Color color = new Color(); // TODO: Initialize to an appropriate value
     TextAlign align = new TextAlign(); // TODO: Initialize to an appropriate value
     TextDrawer target = new TextDrawer(font, text, position, color, align); // TODO: Initialize to an appropriate value
     Rectangle actual;
     actual = target.BoundBox;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #14
0
ファイル: TextDrawerTest.cs プロジェクト: YogurtFP/YogUI
 public void DrawTest()
 {
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     Vector2 position = new Vector2(); // TODO: Initialize to an appropriate value
     Color color = new Color(); // TODO: Initialize to an appropriate value
     TextAlign align = new TextAlign(); // TODO: Initialize to an appropriate value
     TextDrawer target = new TextDrawer(font, text, position, color, align); // 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.");
 }
コード例 #15
0
ファイル: ComboBox.cs プロジェクト: YogurtFP/YogUI
        public ComboBox(Vector2 position, SpriteFont font, params string[] items)
        {
            Position = position;
            drop = new DropDownList(position + new Vector2((-width - 15), height / 2), font);
            label = new TextDrawer(font, "", position, Color.White, TextAlign.Center);
            drop.Hide();
            foreach (string item in items)
            {
                drop.AddItem(new Structs.DropDownItem(item, () => { updateSelected(); }));
            }
            if (items.Length > 0)
                selectedIndex = -1;

            base.UIC_Initialize();
        }
コード例 #16
0
        public ComboBox(Vector2 position, SpriteFont font, params string[] items)
        {
            Position = position;
            drop     = new DropDownList(position + new Vector2((-width - 15), height / 2), font);
            label    = new TextDrawer(font, "", position, Color.White, TextAlign.Center);
            drop.Hide();
            foreach (string item in items)
            {
                drop.AddItem(new Structs.DropDownItem(item, () => { updateSelected(); }));
            }
            if (items.Length > 0)
            {
                selectedIndex = -1;
            }

            base.UIC_Initialize();
        }
コード例 #17
0
ファイル: TextDrawerTest.cs プロジェクト: YogurtFP/YogUI
 public void TextDrawerConstructorTest()
 {
     SpriteFont font = null; // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     Vector2 position = new Vector2(); // TODO: Initialize to an appropriate value
     Color color = new Color(); // TODO: Initialize to an appropriate value
     TextAlign align = new TextAlign(); // TODO: Initialize to an appropriate value
     TextDrawer target = new TextDrawer(font, text, position, color, align);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }