Exemplo n.º 1
0
        public static float MeasureStringWidth(string str, Font font, float scale)
        {
            int         screenw = Game.ScreenResolution.Width;
            int         screenh = Game.ScreenResolution.Height;
            const float height  = 1080f;
            float       ratio   = (float)screenw / screenh;
            float       width   = height * ratio;

            return(MeasureStringWidthNoConvert(str, font, scale) * width);
        }
 public static float GetStringWidth(string text, GTA.UI.Font font = 0, float scale = 1f)
 {
     InputArgument[] arguments = new InputArgument[] { MemoryAccess.CellEmailBcon };
     Function.Call(Hash._BEGIN_TEXT_COMMAND_WIDTH, arguments);
     for (int i = 0; i < text.Length; i += 0x63)
     {
         InputArgument[] argumentArray2 = new InputArgument[] { text.Substring(i, Math.Min(0x63, text.Length - i)) };
         Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, argumentArray2);
     }
     InputArgument[] argumentArray3 = new InputArgument[] { font };
     Function.Call(Hash.SET_TEXT_FONT, argumentArray3);
     InputArgument[] argumentArray4 = new InputArgument[] { scale, scale };
     Function.Call(Hash.SET_TEXT_SCALE, argumentArray4);
     InputArgument[] argumentArray5 = new InputArgument[] { 1 };
     return(1280f * Function.Call <float>(Hash._END_TEXT_COMMAND_GET_WIDTH, argumentArray5));
 }
Exemplo n.º 3
0
 public static float MeasureStringWidthNoConvert(string str, Font font, float scale)
 {
     Function.Call((Hash)0x54CE8AC98E120CAB, "STRING");
     AddLongString(str);
     return(Function.Call <float>((Hash)0x85F061DA64ED2F67, (int)font) * scale);
 }
Exemplo n.º 4
0
 public UIResText(string caption, Point position, float scale, Color color, Font font, Alignment justify)
     : base(caption, position, scale, color, font, false)
 {
     TextAlignment = justify;
 }
 public Text(string caption, PointF position, float scale, System.Drawing.Color color, GTA.UI.Font font, GTA.UI.Alignment alignment, bool shadow, bool outline, float wrapWidth)
 {
     this._pinnedText = new List <IntPtr>();
     this.Enabled     = true;
     this.Caption     = caption;
     this.Position    = position;
     this.Scale       = scale;
     this.Color       = color;
     this.Font        = font;
     this.Alignment   = alignment;
     this.Shadow      = shadow;
     this.Outline     = outline;
     this.WrapWidth   = wrapWidth;
 }
 public Text(string caption, PointF position, float scale, System.Drawing.Color color, GTA.UI.Font font, GTA.UI.Alignment alignment, bool shadow, bool outline) : this(caption, position, scale, color, font, alignment, shadow, outline, 0f)
 {
 }
 public Text(string caption, PointF position, float scale, System.Drawing.Color color, GTA.UI.Font font, GTA.UI.Alignment alignment) : this(caption, position, scale, color, font, alignment, false, false, 0f)
 {
 }