Exemplo n.º 1
0
        public static float MeasureStringWidth(string str, Common.EFont font, float scale)
        {
            var         res    = Screen.ActualResolution;
            const float height = 1080f;
            float       ratio  = res.Width / res.Height;
            float       width  = height * ratio;

            return(MeasureStringWidthNoConvert(str, font, scale) * width);
        }
Exemplo n.º 2
0
        public static float MeasureStringWidth(string str, Common.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);
        }
Exemplo n.º 3
0
 public Text(string caption, Point position, float scale, Color color, Common.EFont font, bool centered)
 {
     Enabled  = true;
     Caption  = caption;
     Position = position;
     Scale    = scale;
     Color    = color;
     FontEnum = font;
     Centered = centered;
 }
Exemplo n.º 4
0
        public static void Draw(string caption, Point position, float scale, Color color, Common.EFont font, Alignment textAlignment, bool dropShadow, bool outline, Size wordWrap)
        {
            int screenw = Game.Resolution.Width;
            int screenh = Game.Resolution.Height;

            const float height = 1080f;
            float       ratio  = (float)screenw / screenh;
            var         width  = height * ratio;

            float x = (position.X) / width;
            float y = (position.Y) / height;

            NativeFunction.CallByName <uint>("SET_TEXT_FONT", (int)font);
            NativeFunction.CallByName <uint>("SET_TEXT_SCALE", 1.0f, scale);
            NativeFunction.CallByName <uint>("SET_TEXT_COLOUR", color.R, color.G, color.B, color.A);

            if (dropShadow)
            {
                NativeFunction.CallByName <uint>("SET_TEXT_DROP_SHADOW");
            }

            if (outline)
            {
                NativeFunction.CallByName <uint>("SET_TEXT_OUTLINE");
            }

            switch (textAlignment)
            {
            case Alignment.Centered:
                NativeFunction.CallByName <uint>("SET_TEXT_CENTRE", true);
                break;

            case Alignment.Right:
                NativeFunction.CallByName <uint>("SET_TEXT_RIGHT_JUSTIFY", true);
                NativeFunction.CallByName <uint>("SET_TEXT_WRAP", 0, x);
                break;
            }

            if (wordWrap != new Size(0, 0))
            {
                float xsize = (position.X + wordWrap.Width) / width;
                NativeFunction.CallByName <uint>("SET_TEXT_WRAP", x, xsize);
            }

            NativeFunction.CallByHash <uint>(0x25fbb336df1804cb, "jamyfafi");      // _SET_TEXT_ENTRY
            AddLongString(caption);


            NativeFunction.CallByHash <uint>(0xcd015e5bb0d96a57, x, y);     // _DRAW_TEXT
        }
Exemplo n.º 5
0
        public new static void Draw(string caption, Point position, float scale, Color color, Common.EFont font, bool centered)
        {
            int screenw = Game.Resolution.Width;
            int screenh = Game.Resolution.Height;

            const float height = 1080f;
            float       ratio  = (float)screenw / screenh;
            var         width  = height * ratio;

            float x = (position.X) / width;
            float y = (position.Y) / height;

            NativeFunction.CallByName <uint>("SET_TEXT_FONT", (int)font);
            NativeFunction.CallByName <uint>("SET_TEXT_SCALE", 1.0f, scale);
            NativeFunction.CallByName <uint>("SET_TEXT_COLOUR", color.R, color.G, color.B, color.A);

            if (centered)
            {
                NativeFunction.CallByName <uint>("SET_TEXT_CENTRE", true);
            }

            NativeFunction.CallByHash <uint>(0x25fbb336df1804cb, "jamyfafi");      // _SET_TEXT_ENTRY
            AddLongString(caption);


            NativeFunction.CallByHash <uint>(0xcd015e5bb0d96a57, x, y);     // _DRAW_TEXT
        }
Exemplo n.º 6
0
 public ResText(string caption, Point position, float scale, Color color, Common.EFont font, Alignment justify) : base(caption, position, scale, color, font, false)
 {
     TextAlignment = justify;
 }
Exemplo n.º 7
0
 public static float MeasureStringWidthNoConvert(string str, Common.EFont font, float scale)
 {
     NativeFunction.CallByHash <ulong>(0x54ce8ac98e120cab, "STRING");
     AddLongString(str);
     return(NativeFunction.CallByHash <float>(0x85f061da64ed2f67, (int)font) * scale);
 }
Exemplo n.º 8
0
        public static void Draw(string caption, Point position, float scale, Color color, Common.EFont font, Alignment textAlignment, bool dropShadow, bool outline, Size wordWrap)
        {
            int screenw = Game.Resolution.Width;
            int screenh = Game.Resolution.Height;

            const float height = 1080f;
            float       ratio  = (float)screenw / screenh;
            var         width  = height * ratio;

            float x = (position.X) / width;
            float y = (position.Y) / height;

            NativeFunction.Natives.SetTextFont((int)font);
            NativeFunction.Natives.SetTextScale(1.0f, scale);
            NativeFunction.Natives.SetTextColour(color.R, color.G, color.B, color.A);

            if (dropShadow)
            {
                NativeFunction.Natives.SetTextDropShadow();
            }

            if (outline)
            {
                NativeFunction.Natives.SetTextOutline();
            }

            switch (textAlignment)
            {
            case Alignment.Centered:
                NativeFunction.Natives.SetTextCentre(true);
                break;

            case Alignment.Right:
                NativeFunction.Natives.SetTextRightJustify(true);
                NativeFunction.Natives.SetTextWrap(0.0f, x);
                break;
            }

            if (wordWrap != new Size(0, 0))
            {
                float xsize = (position.X + wordWrap.Width) / width;
                NativeFunction.Natives.SetTextWrap(x, xsize);
            }

            NativeFunction.Natives.BeginTextCommandDisplayText("jamyfafi");
            AddLongString(caption);
            NativeFunction.Natives.EndTextCommandDisplayText(x, y);
        }
Exemplo n.º 9
0
        public new static void Draw(string caption, Point position, float scale, Color color, Common.EFont font, bool centered)
        {
            int screenw = Game.Resolution.Width;
            int screenh = Game.Resolution.Height;

            const float height = 1080f;
            float       ratio  = (float)screenw / screenh;
            var         width  = height * ratio;

            float x = (position.X) / width;
            float y = (position.Y) / height;

            NativeFunction.Natives.SetTextFont((int)font);
            NativeFunction.Natives.SetTextScale(1.0f, scale);
            NativeFunction.Natives.SetTextColour(color.R, color.G, color.B, color.A);

            if (centered)
            {
                NativeFunction.Natives.SetTextCentre(true);
            }

            NativeFunction.Natives.BeginTextCommandDisplayText("jamyfafi");
            AddLongString(caption);
            NativeFunction.Natives.EndTextCommandDisplayText(x, y);
        }
Exemplo n.º 10
0
        public static void Draw(string caption, Point position, float scale, Color color, Common.EFont font, bool centered)
        {
            float x = position.X / 1280.0f;
            float y = position.Y / 720.0f;

            NativeFunction.Natives.SetTextFont((int)font);
            NativeFunction.Natives.SetTextScale(scale, scale);
            NativeFunction.Natives.SetTextColour(color.R, color.G, color.B, color.A);
            NativeFunction.Natives.SetTextCentre(centered);
            NativeFunction.Natives.BeginTextCommandDisplayText("STRING");
            NativeFunction.Natives.AddTextComponentSubstringPlayerName(caption);
            NativeFunction.Natives.EndTextCommandDisplayText(x, y);
        }
Exemplo n.º 11
0
        public static void Draw(string caption, Point position, float scale, Color color, Common.EFont font, bool centered)
        {
            float x = position.X / 1280.0f;
            float y = position.Y / 720.0f;

            NativeFunction.CallByName <uint>("SET_TEXT_FONT", (int)font);
            NativeFunction.CallByName <uint>("SET_TEXT_SCALE", scale, scale);
            NativeFunction.CallByName <uint>("SET_TEXT_COLOUR", color.R, color.G, color.B, color.A);
            NativeFunction.CallByName <uint>("SET_TEXT_CENTRE", centered);
            NativeFunction.CallByHash <uint>(0x25fbb336df1804cb, "STRING"); // SetTextEntry native
            NativeFunction.CallByHash <uint>(0x6c188be134e074aa, caption);  // AddTextComponentString native
            NativeFunction.CallByHash <uint>(0xcd015e5bb0d96a57, x, y);     // DrawText native
        }