public static Vector2 Draw4(SpriteFontX __inst, SpriteBatch sb, char[] str, Vector2 position, Vector2 maxBound, Vector2 scale, XnaColor color) { Func <Vector2, Vector2> DrawSp = (newPos) => __inst.Draw(sb, str, newPos, maxBound, scale, color); var config = Resource.Config; var alterTextCfg = config.AlterTextCfg; var alterFontCfg = alterTextCfg.AlterFontCfg; var protagonistLineColor = alterFontCfg.ProtagonistLineColor; var antagonistLineColor = alterFontCfg.AntagonistLineColor; if (TestColor(color, XnaColor.Black)) { if (alterTextCfg.Enabled && alterTextCfg.UseBlackBorder) { position.X--; position.Y--; float X = position.X, Y = position.Y; position = new Vector2(X - borderSize, Y - borderSize); DrawSp(position); position = new Vector2(X + borderSize, Y - borderSize); DrawSp(position); position = new Vector2(X + borderSize, Y + borderSize); DrawSp(position); position = new Vector2(X - borderSize, Y + borderSize); DrawSp(position); position = new Vector2(X, Y + borderSize); DrawSp(position); position = new Vector2(X, Y - borderSize); DrawSp(position); position = new Vector2(X - borderSize, Y); DrawSp(position); position = new Vector2(X + borderSize, Y); return(DrawSp(position)); } } return(DrawSp(position)); }
/// <summary> /// 绘制字符数组 (不带Begin End) /// </summary> /// <param name="sb">SpriteBatch</param> /// <param name="sfx">字体X</param> /// <param name="str">字符数组</param> /// <param name="position">位置</param> /// <param name="maxBound">绘制的最大范围限定</param> /// <param name="scale">缩放</param> /// <param name="color">颜色</param> /// <returns>绘制到的范围</returns> public static Vector2 DrawStringX(this SpriteBatch sb, SpriteFontX sfx, Char[] str, Vector2 position, Vector2 maxBound, Vector2 scale, Color color) { return(sfx.Draw(sb, str, position, maxBound, scale, color)); }
/// <summary> /// 绘制字符数组 (不带Begin End) /// </summary> /// <param name="sb">SpriteBatch</param> /// <param name="sfx">字体X</param> /// <param name="str">字符串</param> /// <param name="position">位置</param> /// <param name="maxBound">绘制的最大范围限定</param> /// <param name="scale">缩放</param> /// <param name="color">颜色</param> /// <returns>绘制到的范围</returns> public static Vector2 DrawStringX(this SpriteBatch sb, SpriteFontX sfx, String str, Vector2 position, Color color) { return(sfx.Draw(sb, str, position, color)); }