Esempio n. 1
0
        private void calculateBaseSizes()
        {
            // compute the max size of a digit and separators in the English font, for the timer part.
            PixelFont     font          = Dialog.Languages["english"].Font;
            float         fontFaceSize  = Dialog.Languages["english"].FontFaceSize;
            PixelFontSize pixelFontSize = font.Get(fontFaceSize);

            for (int i = 0; i < 10; i++)
            {
                float digitWidth = pixelFontSize.Measure(i.ToString()).X;
                if (digitWidth > numberWidth)
                {
                    numberWidth = digitWidth;
                }
            }
            spacerWidth  = pixelFontSize.Measure('.').X;
            numberHeight = pixelFontSize.Measure("0:.").Y;

            // measure the ranks in the font for the current language.
            rankMeasurements = new Dictionary <string, Vector2>()
            {
                { "Gold", ActiveFont.Measure(Dialog.Clean("collabutils2_speedberry_gold") + " ") * targetTimeScale },
                { "Silver", ActiveFont.Measure(Dialog.Clean("collabutils2_speedberry_silver") + " ") * targetTimeScale },
                { "Bronze", ActiveFont.Measure(Dialog.Clean("collabutils2_speedberry_bronze") + " ") * targetTimeScale }
            };
        }
Esempio n. 2
0
        public override void Render()
        {
            //Vector2 vector4 = vector3 + new Vector2(x, (float)(-32 + (this.Exists ? 0 : 64)));

            //float n = Math.Min(1f, 440f / ActiveFont.Measure(this.currentText).X);
            float n = Math.Min(1f, 440f / pixelFont.Get(48f).Measure(this.currentText).X);

            Draw.Rect(pos, size.X, size.Y, Color.White);
            if (this.bar && LevelEditor.selected == this)
            {
                //Draw.SpriteBatch.DrawString(Draw.DefaultFont, this.currentText + "|", pos, Color.Black * 0.8f);
                pixelFont.Draw(48f, currentText + "|", pos, new Vector2(0f, 0f), Vector2.One * n, Color.Black * 0.8f, 0f, Color.Transparent, 0f, Color.Transparent);
                //ActiveFont.Draw(this.currentText + "|", pos, new Vector2(0f, 0f), Vector2.One * n, Color.Black * 0.8f);
            }
            else
            {
                //Draw.SpriteBatch.DrawString(Draw.DefaultFont, this.currentText + "|", pos, Color.Black * 0.8f);
                pixelFont.Draw(48f, currentText, pos, new Vector2(0f, 0f), Vector2.One * n, Color.Black * 0.8f, 0f, Color.Transparent, 0f, Color.Transparent);
                //ActiveFont.Draw(this.currentText, pos, new Vector2(0f, 0f), Vector2.One * n, Color.Black * 0.8f);
            }

            foreach (GUIElement child in children)
            {
                child.Render();
            }
        }
Esempio n. 3
0
        public static void CalculateBaseSizes()
        {
            PixelFont     font          = Dialog.Languages["english"].Font;
            float         fontFaceSize  = Dialog.Languages["english"].FontFaceSize;
            PixelFontSize pixelFontSize = font.Get(fontFaceSize);

            for (int i = 0; i < 10; i++)
            {
                float x = pixelFontSize.Measure(i.ToString()).X;
                if (x > numberWidth)
                {
                    numberWidth = x;
                }
            }
            spacerWidth = pixelFontSize.Measure('.').X;
        }
Esempio n. 4
0
        private void CalculateBaseSizes()
        {
            // compute the max size of a digit and separators in the English font, for the timer part.
            PixelFont     font          = Dialog.Languages["english"].Font;
            float         fontFaceSize  = Dialog.Languages["english"].FontFaceSize;
            PixelFontSize pixelFontSize = font.Get(fontFaceSize);

            for (int i = 0; i < 10; i++)
            {
                float digitWidth = pixelFontSize.Measure(i.ToString()).X;
                if (digitWidth > numberWidth)
                {
                    numberWidth = digitWidth;
                }
            }
            spacerWidth = pixelFontSize.Measure('.').X;
        }