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(); }
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); }
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(); }
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(); }
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(); }
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; }
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."); }
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."); }
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(); }
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(); }
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"); }