示例#1
0
 public override void PreDraw(Scene scene)
 {
     base.PreDraw(scene);
     scene.PushSpriteBatch(blendState: scene.NonPremultiplied, samplerState: SamplerState.PointWrap, projection: Projection);
     scene.GraphicsDevice.Clear(Color.TransparentBlack);
     Text.Draw(new Vector2(0, -Scroll), FontRenderer);
     scene.PopSpriteBatch();
 }
示例#2
0
        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();
        }