Beispiel #1
0
        public static void TextInCell(ref Frame frame, EFont font, string text, double x, double y)
        {
            double xx = Const.FieldOriginX + x * Const.TileWidth + Const.TileWidth / 2;
            double yy = Const.FieldOriginY + y * Const.TileHeight + Const.TileHeight / 2;

            frame.Add(new Text(font, new Point2(TextX(text, xx), yy), Const.smallLetterWidth, Const.smallLetterHeight, text));
        }
Beispiel #2
0
 /// <summary>
 /// Задается позиция центра, ширина и высота всего текста
 /// </summary>
 public Text(EFont font, Vector2 pos, double textWidth, double textHeight, params string[] lines)
 {
     this.lines  = new List <string>(lines);
     this.pos    = pos;
     this.height = textHeight;
     this.width  = textWidth;
     this.font   = font;
 }
Beispiel #3
0
        public static float MeasureStringWidth(string str, EFont font, float scale)
        {
            int         screenw = Game.Resolution.Width;
            int         screenh = Game.Resolution.Height;
            const float height  = 1080f;
            float       ratio   = (float)screenw / screenh;
            float       width   = height * ratio;

            return(MeasureStringWidthNoConvert(str, font, scale) * width);
        }
Beispiel #4
0
 public Text(string caption, Point position, float scale, Color color, EFont font, bool centered)
 {
     Enabled  = true;
     Caption  = caption;
     Position = position;
     Scale    = scale;
     Color    = color;
     FontEnum = font;
     Centered = centered;
 }
Beispiel #5
0
        /// <summary>
        /// задается ширина и высота отдельной буквы, верхний левый угол
        /// </summary>
        public Text(EFont font, Point2 loc, double letterWidth, double letterHeight, params string[] lines)
        {
            this.lines = new List <string>(lines);
            int r = 0;

            foreach (string s in lines)
            {
                if (s.Length > r)
                {
                    r = s.Length;
                }
            }
            width     = letterWidth * r;
            height    = letterHeight * this.lines.Count;
            this.font = font;

            pos = new Vector2(loc.x + width / 2, loc.y + height / 2, 0);
        }
Beispiel #6
0
 public SpriteFont GetFont(EFont fontName)
 {
     if (font == null)
         LoadFonts();
     return font[(int)fontName];
 }
Beispiel #7
0
 public static float MeasureStringWidthNoConvert(string str, EFont font, float scale)
 {
     NativeFunction.CallByHash <ulong>(0x54ce8ac98e120cab, "STRING");
     AddLongString(str);
     return(NativeFunction.CallByHash <float>(0x85f061da64ed2f67, (int)font) * scale);
 }
Beispiel #8
0
 public ResText(string caption, Point position, float scale, Color color, EFont font, Alignment justify)
     : base(caption, position, scale, color, font, false)
 {
     TextAlignment = justify;
 }
Beispiel #9
0
 public Vector2 getSizeString(EFont font, String content)
 {
     return fonts[font].MeasureString(content);
 }
Beispiel #10
0
 public float getLineSpacing(EFont font)
 {
     return fonts[font].LineSpacing;
 }