public DialogParams Transform(DialogParams par, TextCursorPosition pos) { par = TransformShow(par, pos, ShowSlider.GetSlide(pos)); par = TransformHighlight(par, pos, HighlightSlider.GetSlide(pos)); par = TransformHide(par, pos, HideSlider.GetSlide(pos)); return(par); }
public void IncrementPosition(ref TextCursorPosition cursorPos) { foreach (var element in Contents) { element.IncrementPosition(ref cursorPos); } }
public static DialogParams DefaultParams(TextCursorPosition position) => new DialogParams() { Color = Color.White, Border = Color.Black, Offset = Vector2.Zero, Scale = Vector2.One, Angle = 0, };
private static DialogParams TransformHide(DialogParams param, TextCursorPosition pos, float slide) { if (slide >= 1) { param.Color = Color.Transparent; param.Border = Color.Transparent; } return(param); }
private static DialogParams Transform(DialogParams param, TextCursorPosition pos, float slide) { if (slide <= 0) { param.Color = Color.Transparent; param.Border = Color.Transparent; } param.Scale = Vector2.Lerp(new Vector2(3, 3), Vector2.One, slide); return(param); }
private static DialogParams Transform(DialogParams param, TextCursorPosition pos, float slide) { if (slide <= 0) { param.Color = Color.Transparent; param.Border = Color.Transparent; } else { float angle = Util.RandomNoise(pos.GlobalCharacter) * MathHelper.TwoPi; param.Offset = Vector2.Lerp(Util.AngleToVector(angle) * 20, Vector2.Zero, MathHelper.Clamp(slide * 2, 0, 1)); param.Scale = Vector2.Lerp(new Vector2(3, 3), Vector2.One, MathHelper.Clamp(slide * 2, 0, 1)); param.Border = Color.Lerp(Color.Orange.RotateHue(pos.GlobalCharacter / 20f), Color.Black, slide); } return(param); }
private DialogParams TransformShow(DialogParams param, TextCursorPosition pos, float slide) { if (slide <= 0) { //param.Color = Color.Transparent; //param.Border = Color.Transparent; } else { float angle = Util.RandomNoise(pos.GlobalCharacter) * MathHelper.TwoPi; //param.Offset = Vector2.Lerp(Util.AngleToVector(angle) * 20, Vector2.Zero, MathHelper.Clamp(slide * 2, 0, 1)); //param.Scale = Vector2.Lerp(new Vector2(3, 3), Vector2.One, MathHelper.Clamp(slide * 2, 0, 1)); var colorSlide = (float)LerpHelper.ForwardReverse(1, 0, slide); param.Border = Color.Lerp(Color.Gold, Color.Black, colorSlide); } param.Offset = Vector2.Lerp(-pos.Position, Vector2.Zero, (float)LerpHelper.QuadraticOut(0, 1, AppearSlide.Slide)); return(param); }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { float offset = 0; float alignOffset = 0; renderer.Scene.PushSpriteBatch(transform: Position.Transform * baseTransform); renderer.DrawAreaDebug(Vector2.Zero, new Vector2(Width, Height)); int i = 0; foreach (var element in Contents) { element.Draw(this, baseTransform, renderer, cursorPos + new Vector2(offset + alignOffset, 0)); element.IncrementPosition(ref cursorPos); offset += element.Width + (i < Contents.Count - 1 ? ColumnConfigs.Padding : 0); i++; } renderer.Scene.PopSpriteBatch(); }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { var par = Format.GetParams(cursorPos); par = Dialog.Transform(par, cursorPos); Color color = par.Color; Vector2 offset = par.Offset; Vector2 scale = par.Scale; float angle = par.Angle; renderer.Scene.PushSpriteBatch(transform: Matrix.CreateTranslation(-8, -8, 0) * Matrix.CreateScale(scale.X, scale.Y, 0) * Matrix.CreateRotationZ(angle) * Matrix.CreateTranslation(8, 8, 0) * Position.Transform * baseTransform); if (color.A > 0) { Symbol.DrawIcon(renderer.Scene, offset, par, 0); } renderer.Scene.PopSpriteBatch(); }
public void IncrementPosition(ref TextCursorPosition cursorPos) { cursorPos.AddCharacters(1); cursorPos.IncrementElement(); }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { renderer.DrawChars(Text, Width, Height, Format, Dialog, Position.Transform * baseTransform, cursorPos); }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { var charOffset = Vector2.Zero; var color = Color.White; var border = Color.Black; //TODO: formatting //renderer.DrawCharLine(charOffset + new Vector2(0, 15), (int)Width, color, border); //renderer.DrawCharLine(charOffset + new Vector2(0, 8), (int)Width, color, border); }
public float GetSlide(TextCursorPosition pos) { float n = (CharacterCurrent + Interval.Slide) * Interval.EndTime; return(MathHelper.Clamp((n - pos.LocalCharacter * Interval.EndTime) / Lag, 0, 1)); }
public float GetSlide(TextCursorPosition pos) { return(SliderLag.Slide); }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { if (Selected()) { renderer.Scene.PushSpriteBatch(transform: Position.Transform * baseTransform); renderer.Scene.DrawSprite(Sprite, 0, new Vector2(Width / 2, Height / 2) - Sprite.Middle, SpriteEffects.None, 0); renderer.Scene.PopSpriteBatch(); } }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { var sprite = SpriteLoader.Instance.AddSprite("content/ui_slider_bar"); var cursor = SpriteLoader.Instance.AddSprite("content/cursor"); var barSlide = BarSlide(); int bars = (int)Math.Round(BarCount * barSlide); if (bars <= 0 && barSlide > 0) { bars = 1; } if (bars >= BarCount - 1 && barSlide < 1) { bars = BarCount - 1; } renderer.Scene.PushSpriteBatch(transform: Position.Transform * baseTransform); if (barSlide > 0) { renderer.Scene.DrawSprite(cursor, 0, new Vector2(0, 0), SpriteEffects.FlipHorizontally, 0); } for (int i = 0; i < BarCount; i++) { renderer.Scene.DrawSprite(sprite, 0, new Vector2(16 + i * 5 - 1, 0), SpriteEffects.None, i < bars ? Color.White : Color.Gray, 0); } if (barSlide < 1) { renderer.Scene.DrawSprite(cursor, 0, new Vector2(16 + BarCount * 5 - 1, 0), SpriteEffects.None, 0); } renderer.Scene.PopSpriteBatch(); }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { renderer.Scene.PushSpriteBatch(transform: Position.Transform * baseTransform); renderer.DrawAreaDebug(Vector2.Zero, new Vector2(Width, Height)); float yOffset = 0; foreach (var element in Contents) { element.Draw(this, baseTransform, renderer, cursorPos + new Vector2(0, yOffset)); element.IncrementPosition(ref cursorPos); yOffset += element.Height; } renderer.Scene.PopSpriteBatch(); }
public void IncrementPosition(ref TextCursorPosition cursorPos) { cursorPos.IncrementElement(); }
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { renderer.DrawChars(BackgroundText, Width, Height, FormatBack, Dialog, Position.Transform * baseTransform, cursorPos); var offset = GetBackgroundWidth() - GetForegroundWidth(); renderer.DrawChars(ForegroundText, Width, Height, FormatFront, Dialog, Matrix.CreateTranslation(offset, 0, 0) * Position.Transform * baseTransform, cursorPos); }
public void DrawChars(IEnumerable <char> chars, float width, float height, TextFormatting format, TextDialog dialog, Matrix transform, TextCursorPosition cursorPos) { float offset = 0; var skew = new Matrix( 1, 0, 0, 0, format.Italic ? -4f / 16 : 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ); var skewCenter = Matrix.CreateTranslation(-width / 2, -height / 2, 0) * skew * Matrix.CreateTranslation(width / 2, height / 2, 0); Scene.PushSpriteBatch(transform: skewCenter * transform); DrawAreaDebug(Vector2.Zero, new Vector2(width, height)); foreach (var chr in chars) { var par = format.GetParams(cursorPos + new Vector2(offset, 0)); DrawChar(chr, new Vector2(offset, 0), format, dialog.Transform(par, cursorPos + new Vector2(offset, 0))); cursorPos.AddCharacters(1); offset += format.GetCharWidth(chr) + 1; } Scene.PopSpriteBatch(); }
public void IncrementPosition(ref TextCursorPosition cursorPos) { cursorPos.AddCharacters(BackgroundText.Length); cursorPos.IncrementElement(); }
public static DialogParams TransformIdentity(DialogParams param, TextCursorPosition pos, float slide) => param;
public void Draw(ITextContainer parent, Matrix baseTransform, FontRenderer renderer, TextCursorPosition cursorPos) { float offsetX = (Width - GetWidth()) * 1f; switch (Alignment) { case (LineAlignment.Left): offsetX = 0; break; case (LineAlignment.Center): offsetX *= 0.5f; break; case (LineAlignment.Right): break; } renderer.DrawChars(Text, Width, Height, Format, Dialog, Position.Transform * baseTransform * Matrix.CreateTranslation(offsetX, 0, 0), cursorPos); }