Esempio n. 1
0
        public static float GetTextWidth(string text, RAGE.Game.Font textFont)
        {
            RAGE.Game.Ui.BeginTextCommandWidth("STRING");
            RAGE.Game.Ui.AddTextComponentSubstringPlayerName(text);

            RAGE.Game.Ui.SetTextFont((int)textFont);
            RAGE.Game.Ui.SetTextScale(1f, 0.5f);

            return(RAGE.Game.Ui.EndTextCommandGetWidth((int)textFont));
        }
Esempio n. 2
0
        public static void DrawText3D(string text, Vector3 position, Color textColor, RAGE.Game.Font textFont)
        {
            var screenX   = 0f;
            var screenY   = 0f;
            var fontScale = 0.4f;

            RAGE.Game.Graphics.GetScreenCoordFromWorldCoord(position.X, position.Y, position.Z, ref screenX, ref screenY);

            RAGE.Game.Ui.SetTextOutline();
            RAGE.Game.Ui.SetTextProportional(true);
            RAGE.Game.Ui.SetTextCentre(true);
            RAGE.Game.Ui.SetTextFont((int)textFont);
            RAGE.Game.Ui.SetTextScale(fontScale, fontScale);
            RAGE.Game.Ui.SetTextColour(textColor.R, textColor.G, textColor.B, textColor.A);

            RAGE.Game.Ui.BeginTextCommandDisplayText("STRING");

            RAGE.Game.Ui.AddTextComponentSubstringPlayerName(text);

            RAGE.Game.Ui.EndTextCommandDisplayText(screenX, screenY, 0);

            var rectWidth = GetTextWidth(text, textFont) * 0.85f;

            RAGE.Game.Graphics.DrawRect(screenX, screenY + 0.0155f, rectWidth, 0.03f, 41, 11, 41, 200, 0);
        }