Esempio n. 1
0
        private void DrawTextScrn(int font, DrawBrush brush, Vector3d a, Vector3d xdir, Vector3d ydir, string s, double imgScale, DrawTextOption opt)
        {
            Start2D();

            FontTex tex = mFontFaceW.CreateTexture(s);

            Vector3d xv = xdir.UnitVector() * tex.ImgW * imgScale;
            Vector3d yv = ydir.UnitVector() * tex.ImgH * imgScale;

            if ((opt.Option & DrawTextOption.H_CENTER) != 0)
            {
                a -= (xv / 2);
            }

            if (xv.IsZero() || yv.IsZero())
            {
                return;
            }

            GL.Color4(brush.Color4());

            mFontRenderer.Render(tex, a, xv, yv);

            End2D();
        }
Esempio n. 2
0
        public DrawingGL(DrawContextGL dc)
        {
            DC = dc;

            mFontFaceW = new FontFaceW();
            //mFontFaceW.SetFont(@"C:\Windows\Fonts\msgothic.ttc", 0);
            mFontFaceW.SetResourceFont("/Fonts/mplus-1m-regular.ttf");
            mFontFaceW.SetSize(24);

            mFontRenderer = new FontRenderer();
            mFontRenderer.Init();

            FontTex tex = mFontFaceW.CreateTexture("X");

            FontTexW = tex.ImgW;
            FontTexH = tex.ImgH;
        }
Esempio n. 3
0
        public void DrawText(int font, DrawBrush brush, Vector3d a, Vector3d xdir, Vector3d ydir, DrawTextOption opt, string s)
        {
            a *= DC.WorldScale;

            FontTex tex = mFontFaceW.CreateTexture(s);

            Vector3d xv = xdir.UnitVector() * tex.ImgW * 0.15;
            Vector3d yv = ydir.UnitVector() * tex.ImgH * 0.15;

            if (xv.IsZero() || yv.IsZero())
            {
                return;
            }

            if ((opt.Option & DrawTextOption.H_CENTER) != 0)
            {
                a -= (xv / 2);
            }

            GL.Color4(brush.Color4());

            mFontRenderer.Render(tex, a, xv, yv);
        }