public override void Render() { if (ease > 0f) { Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * ease * 0.4f); } base.Render(); const float spacingX = 48f; const float spacingY = 64f; Vector2 posCenter = Position + new Vector2(1920f / 2f, 1080f / 2f); Vector2 pos; // Vector2 posInput = posCenter - new Vector2(spacingX * (digits.Length - 1f) / 2f, spacingY * 0.5f); Vector2 posInput = Position + new Vector2(384f, 1080f / 2f); pos = posInput; for (int i = 0; i < digits.Length; i++) { DrawOptionText(digits[i].ToString("X1"), pos + new Vector2(0f, wigglerDigits[i].Value * 8f), new Vector2(0f, 0.5f), Vector2.One, selectedDigit == i, i <= 1); pos.X += spacingX; } // pos = posCenter + new Vector2(0f, spacingY * 0.5f + wigglerPath.Value * 2f); pos = posInput + new Vector2(spacingX * 2f, spacingY * 0.8f + wigglerPath.Value * 2f); ActiveFont.DrawOutline(selectedPath ?? "", pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.White * ease, 2f, Color.Black * ease * ease * ease); pos = posInput + new Vector2(0f, spacingY * -0.8f + wigglerBankPath.Value * 2f); ActiveFont.DrawOutline(selectedBankPath ?? "", pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.LightSlateGray * ease, 2f, Color.Black * ease * ease * ease); ActiveFont.DrawEdgeOutline(Dialog.Clean("soundtest_title"), Position + new Vector2(960f, 256f), new Vector2(0.5f, 0.5f), Vector2.One * 2f, Color.Gray, 4f, Color.DarkSlateBlue, 2f, Color.Black); }
public override void Render() { if (alpha > 0f) { Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * alpha * 0.6f); } base.Render(); if (Lines == null) { return; } ActiveFont.DrawEdgeOutline(Title, new Vector2(960f, 128f), new Vector2(0.5f, 0.5f), Vector2.One * 2f, Color.Gray * alpha, 4f, Color.DarkSlateBlue * alpha, 2f, Color.Black * (alpha * alpha * alpha)); Draw.Rect(64f, 128f + 64f + 2f, 1920f - 2f * 64f, 4f, Color.Black * alpha * 0.8f); if (ProgressMax > 0) { Draw.Rect(64f, 128f + 64f, (Progress / (float)ProgressMax) * (1920f - 2f * 64f), 8f, Color.White * alpha * 0.8f); } else { // TODO: Indeterminate progress bar! } Rectangle log = new Rectangle(1920 / 2 - logBounds.Width / 2, 128 + 64 + 16, logBounds.Width, logBounds.Height); Draw.Rect(log, Color.Black * alpha * 0.8f); if (logBuffer != null) { Draw.SpriteBatch.Draw(logBuffer.Target, log, Color.White * alpha); } }
public override void Render() { int prevIndex = index; // Only "focus" if the input method is a gamepad, not a keyboard. if (!MInput.GamePads[Input.Gamepad].Attached) { index = -1; } // TODO: Rewrite or study and document the following code. // It stems from OuiFileNaming. Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * 0.8f * ease); Vector2 pos = boxtopleft + new Vector2(boxPadding, boxPadding); int letterIndex = 0; foreach (string letter in letters) { for (int i = 0; i < letter.Length; i++) { bool selected = letterIndex == line && i == index && !selectingOptions; Vector2 scale = Vector2.One * (selected ? 1.2f : 1f); Vector2 posLetter = pos + new Vector2(widestLetter, lineHeight) / 2f; if (selected) { posLetter += new Vector2(0f, wiggler.Value) * 8f; } DrawOptionText(letter[i].ToString(), posLetter, new Vector2(0.5f, 0.5f), scale, selected); pos.X += widestLetter; } pos.X = boxtopleft.X + boxPadding; pos.Y += lineHeight + lineSpacing; letterIndex++; } float wiggle = wiggler.Value * 8f; pos.Y = boxtopleft.Y + boxHeight - lineHeight - boxPadding; Draw.Rect(pos.X, pos.Y - boxPadding * 0.5f, boxWidth - boxPadding * 2f, 4f, Color.White); DrawOptionText(cancel, pos + new Vector2(0f, lineHeight + ((selectingOptions && optionsIndex == 0) ? wiggle : 0f)), new Vector2(0f, 1f), Vector2.One * optionsScale, selectingOptions && optionsIndex == 0); pos.X = boxtopleft.X + boxWidth - backspaceWidth - widestLetter - spaceWidth - widestLetter - beginWidth - boxPadding; DrawOptionText(space, pos + new Vector2(0f, lineHeight + ((selectingOptions && optionsIndex == 1) ? wiggle : 0f)), new Vector2(0f, 1f), Vector2.One * optionsScale, selectingOptions && optionsIndex == 1, Value.Length == 0 || !Focused); pos.X += spaceWidth + widestLetter; DrawOptionText(backspace, pos + new Vector2(0f, lineHeight + ((selectingOptions && optionsIndex == 2) ? wiggle : 0f)), new Vector2(0f, 1f), Vector2.One * optionsScale, selectingOptions && optionsIndex == 2, Value.Length <= 0 || !Focused); pos.X += backspaceWidth + widestLetter; DrawOptionText(accept, pos + new Vector2(0f, lineHeight + ((selectingOptions && optionsIndex == 3) ? wiggle : 0f)), new Vector2(0f, 1f), Vector2.One * optionsScale, selectingOptions && optionsIndex == 3, Value.Length < 1 || !Focused); ActiveFont.DrawEdgeOutline(Value, Position + new Vector2(960f, 256f), new Vector2(0.5f, 0.5f), Vector2.One * 2f, Color.Gray, 4f, Color.DarkSlateBlue, 2f, Color.Black); index = prevIndex; }
public override void Render() { int prevIndex = index; // Only "focus" if we're not using the keyboard for input if (UseKeyboardInput) { index = -1; } Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * 0.8f * ease); // draw the keyboard Vector2 drawingPosition = keyboardTopLeft + new Vector2(boxPadding, boxPadding); int letterIndex = 0; foreach (string letter in letters) { for (int i = 0; i < letter.Length; i++) { bool selected = letterIndex == line && i == index && !selectingOptions; Vector2 scale = Vector2.One * (selected ? 1.7f : 1.4f); Vector2 posLetter = drawingPosition + new Vector2(widestLetter, lineHeight) / 2f; if (selected) { posLetter += new Vector2(0f, wiggler.Value) * 8f; } DrawOptionText(letter[i].ToString(), posLetter, new Vector2(0.5f, 0.5f), scale, selected); drawingPosition.X += widestLetter; } drawingPosition.X = keyboardTopLeft.X + boxPadding; drawingPosition.Y += lineHeight + lineSpacing * 1.4f; letterIndex++; } float wiggle = wiggler.Value * 8f; // draw the boundary line between keyboard and options drawingPosition.X = boxTopLeft.X + boxPadding; drawingPosition.Y = boxTopLeft.Y + boxHeight - lineHeight - boxPadding; Draw.Rect(drawingPosition.X, drawingPosition.Y - boxPadding * 0.5f, boxWidth - boxPadding * 2f, 4f, Color.White); // draw the 3 options DrawOptionText(cancel, drawingPosition + new Vector2(15f, lineHeight + ((selectingOptions && optionsIndex == 0) ? wiggle : 0f)), new Vector2(0f, 1f), Vector2.One * optionsScale, selectingOptions && optionsIndex == 0, !Focused); drawingPosition.X = boxTopLeft.X + boxWidth - backspaceWidth - widestLetter - widestLetter - acceptWidth - boxPadding; DrawOptionText(backspace, drawingPosition + new Vector2(15f, lineHeight + ((selectingOptions && optionsIndex == 1) ? wiggle : 0f)), new Vector2(0f, 1f), Vector2.One * optionsScale, selectingOptions && optionsIndex == 1, Value.Length <= 0 || !Focused); drawingPosition.X += backspaceWidth + widestLetter; DrawOptionText(accept, drawingPosition + new Vector2(10f, lineHeight + ((selectingOptions && optionsIndex == 2) ? wiggle : 0f)), new Vector2(0f, 1f), Vector2.One * optionsScale, selectingOptions && optionsIndex == 2, Value.Length < 1 || !Focused); // draw the current value ActiveFont.DrawEdgeOutline(Value, Position + new Vector2(960f, 286f), new Vector2(0.5f, 0.5f), Vector2.One * 2f, Color.Gray, 4f, Color.DarkSlateBlue, 2f, Color.Black); index = prevIndex; }
public override void Render() { if (ease > 0f) { Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * ease * 0.4f); } base.Render(); const float spacingX = 48f; const float spacingY = 64f; Vector2 posCenter = Position + new Vector2(1920f / 2f, 1080f / 2f); Vector2 pos; // Vector2 posInput = posCenter - new Vector2(spacingX * (digits.Length - 1f) / 2f, spacingY * 0.5f); Vector2 posInput = Position + new Vector2(384f, 1080f / 2f); pos = posInput; for (int i = 0; i < digits.Length; i++) { DrawOptionText(digits[i].ToString("X1"), pos + new Vector2(0f, wigglerDigits[i].Value * 8f), new Vector2(0f, 0.5f), Vector2.One, selectedDigit == i && !musicParamMenu.Focused, i <= 1); pos.X += spacingX; } // pos = posCenter + new Vector2(0f, spacingY * 0.5f + wigglerPath.Value * 2f); pos = posInput + new Vector2(spacingX * 2f, spacingY * 0.8f + wigglerPath.Value * 2f); ActiveFont.DrawOutline(selectedPath ?? "", pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.White * ease, 2f, Color.Black * ease * ease * ease); pos = posInput + new Vector2(0f, spacingY * -0.8f + wigglerBankPath.Value * 2f); ActiveFont.DrawOutline(selectedBankPath ?? "", pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.LightSlateGray * ease, 2f, Color.Black * ease * ease * ease); if (musicParamMenu.GetItems().Count > 0) { // Press... pos = posInput + new Vector2(0f, spacingY * 2f + wigglerBankPath.Value * 2f); ActiveFont.DrawOutline(Dialog.Clean("SOUNDTEST_AUDIOPARAMS_OPEN_1"), pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.White * ease, 2f, Color.Black * ease * ease * ease); // ... [button image] ... pos.X += ActiveFont.Measure(Dialog.Clean("SOUNDTEST_AUDIOPARAMS_OPEN_1")).X * 0.75f + 10f; MTexture button = Input.GuiButton(Input.MenuJournal); button.DrawJustified(pos, new Vector2(0f, 0.5f), Color.White, 0.75f); pos.X += button.Width * 0.75f + 10f; // ... to edit Audio Params ActiveFont.DrawOutline(Dialog.Clean("SOUNDTEST_AUDIOPARAMS_OPEN_2"), pos, new Vector2(0f, 0.5f), Vector2.One * 0.75f, Color.White * ease, 2f, Color.Black * ease * ease * ease); } ActiveFont.DrawEdgeOutline(Dialog.Clean("soundtest_title"), Position + new Vector2(960f, 256f), new Vector2(0.5f, 0.5f), Vector2.One * 2f, Color.Gray, 4f, Color.DarkSlateBlue, 2f, Color.Black); if (musicParamMenuEase > 0f) { Draw.Rect(-10f, -10f, 1940f, 1100f, Color.Black * 0.95f * Ease.CubeInOut(musicParamMenuEase)); musicParamMenu.Alpha = Ease.CubeInOut(musicParamMenuEase); musicParamMenu.Render(); } }
private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false) { Color color = disabled ? disableColor : GetTextColor(selected); Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray; if (selected && pressedTimer > 0f) { ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color); } else { ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor); } }
public override void Render(Vector2 position, bool highlighted) { float alpha = Container.Alpha; Color strokeColor = Color.Black * (alpha * alpha * alpha); Vector2 pos = position + Alignment switch { TextAlignment.Center => new Vector2(Container.Width * 0.5f, 0f), TextAlignment.Right => new Vector2(Container.Width, 0f), _ => Vector2.Zero }; Vector2 justification = Alignment switch { TextAlignment.Left => new Vector2(0, 0.5f), TextAlignment.Center => new Vector2(0.5f, 0.5f), _ => new Vector2(1, 0.5f) }; ActiveFont.DrawEdgeOutline(Title, pos, justification, Vector2.One * 2f * Scale, Color.Gray * alpha, 4f, Color.DarkSlateBlue * alpha, 2f, strokeColor); } }
public override void Render() { base.Render(); ActiveFont.DrawEdgeOutline(Dialog.Get("MODOPTIONS_RANDOMIZER_LOGIC"), this.Position, new Vector2(0.5f, 0.5f), Vector2.One * 2f, Color.Gray, 4f, Color.DarkSlateBlue, 2f, Color.Black); for (var i = 0; i < this.Icons.Length; i++) { var x = this.X + this.MenuOffset.X + this.Ease[i] * this.Indent; var y = this.Y + this.MenuOffset.Y + i * this.VerticalSpacing; var color = Color.White; if (i == this.Index) { color = !Settings.Instance.DisableFlashes && !this.Scene.BetweenInterval(0.1f) ? TextMenu.HighlightColorB : TextMenu.HighlightColorA; } this.Icons[i].DrawCentered(new Vector2(x, y), Color.White, new Vector2(this.IconScale, this.IconScale)); ActiveFont.DrawOutline(this.Names[i], new Vector2(x + this.Icons[i].Width * this.IconScale, y), new Vector2(0f, 0.5f), Vector2.One * 1.5f, color, 2f, Color.Black); } }
private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false) { // Only draw "interactively" if the input method is a gamepad, not a keyboard. if (!MInput.GamePads[Input.Gamepad].Attached) { selected = false; disabled = true; } Color color = disabled ? disableColor : GetTextColor(selected); Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray; if (selected && pressedTimer > 0f) { ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color); } else { ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor); } }
private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false) { // Only draw "interactively" if not using the keyboard for input if (UseKeyboardInput) { selected = false; disabled = true; } Color color = disabled ? disableColor : GetTextColor(selected); Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray; if (selected && pressedTimer > 0f) { ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color); } else { ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor); } }
private void DrawOptionText(string text, Vector2 at, Vector2 justify, Vector2 scale, bool selected, bool disabled = false) { // Only draw "interactively" if not using the keyboard for input // Also grey out invalid keys ("-" if negatives are forbidden, "." if decimals are forbidden). if (UseKeyboardInput || (text.Equals("-") && !allowNegatives) || (text.Equals(".") && !allowDecimals)) { selected = false; disabled = true; } Color color = disabled ? disableColor : GetTextColor(selected); Color edgeColor = disabled ? Color.Lerp(disableColor, Color.Black, 0.7f) : Color.Gray; if (selected && pressedTimer > 0f) { ActiveFont.Draw(text, at + Vector2.UnitY, justify, scale, color); } else { ActiveFont.DrawEdgeOutline(text, at, justify, scale, color, 4f, edgeColor); } }