예제 #1
0
        public void ApplyToGame()
        {
            // 26-10-2009: enable 'normal' width
            Native.CallOpcode(0x0348, true);

            if (Centered)
            {
                Align = TextDrawAlign.Center;
            }

            Native.CallOpcode(0x0342, false);
            Native.CallOpcode(0x03e4, false);

            // disable shadow, we don't want one!
            Native.CallOpcode(0x060d, false, 0, 0, 0, 0);

            // but we do want a border :)
            // 26-10-2009: fixed bug with Color.A

            if (Color.A == 0)
            {
                Native.CallOpcode(0x081c, BorderEnabled, 0, 0, 0, 255);
            }
            else
            {
                Native.CallOpcode(0x081c, BorderEnabled, 0, 0, 0, Color.A);
            }

            if (Align == TextDrawAlign.Center)
            {
                Native.CallOpcode(0x0342, true);
            }
            else if (Align == TextDrawAlign.Right)
            {
                Native.CallOpcode(0x03e4, true);
            }

            /*if (Align != TextDrawAlign.Left)
             * {*/
            //Native.CallOpcode(0x0343, 640.0f);
            Native.CallOpcode(0x0343, LineWidth);

            /*}
             * else
             * {
             *  Native.CallOpcode(0x0343, 0.0f);
             * }*/

            if (Size > 0)
            {
                // let's take 100 == 1.0 height

                float height = (int)(Size / 100);

                // could have fixed the bug, but it causes incompatiblity
                if (Size < 30f)
                {
                    height = Size;
                }

                float width = (height * 0.224f);
                Native.CallOpcode(0x033f, width, height);

                //Initialize.Log(string.Format("Font size: {0} {1}", width, height));
            }

            if (Font != -1)
            {
                Native.CallOpcode(0x0349, Font);
            }

            if (Color.A != 0)
            {
                Native.CallOpcode(0x0340, Color.R, Color.G, Color.B, Color.A);
            }
        }