Esempio n. 1
0
        public void Update(DX11RenderContext context)
        {
            if (!this.FOutTextWrapper[0].Contains(context))
            {
                SharpFontWrapper.FontWrapperCreationParameters createParams = new SharpFontWrapper.FontWrapperCreationParameters()
                {
                    AnisotropicFiltering  = aniso[0] ? 1 : 0,
                    GlyphSheetWidth       = sheetSizeX[0],
                    GlyphSheetHeight      = sheetSizeY[0],
                    DisableGeometryShader = 0,
                    MaxGlyphCountPerSheet = 0,
                    MaxGlyphHeight        = glyphHeight[0],
                    MaxGlyphWidth         = glyphWidth[0],
                    SheetMipLevels        = sheetMips[0],
                    VertexBufferSize      = 0,
                    DefaultFontParams     = new SharpFontWrapper.DirectWriteFontParameters()
                    {
                        FontFamily  = "Arial",
                        FontStretch = SharpDX.DirectWrite.FontStretch.Normal,
                        FontStyle   = SharpDX.DirectWrite.FontStyle.Normal,
                        FontWeight  = SharpDX.DirectWrite.FontWeight.Normal,
                    }
                };

                var wrapper = FontWrapperFactory.GetFactory().CreateFontWrapper(
                    new SharpDX.Direct3D11.Device(context.Device.ComPointer),
                    new SharpDX.DirectWrite.Factory(this.dwFactory.ComPointer), ref createParams);
                this.FOutTextWrapper[0][context] = new TextFontRenderer(wrapper);
            }
        }
Esempio n. 2
0
        public void Apply(TextLayout layout)
        {
            if (Enabled)
            {
                var factory = FontWrapperFactory.GetFactory();

                var            sc = this.Color;
                SharpDX.Color4 c  = *(SharpDX.Color4 *) & sc;

                colorStyle = factory.CreateColor(c);

                SharpDX.DirectWrite.TextLayout tl = new SharpDX.DirectWrite.TextLayout(layout.ComPointer);
                tl.SetDrawingEffect(colorStyle.NativePointer, new SharpDX.DirectWrite.TextRange(Range.StartPosition, Range.Length));
                Marshal.Release(colorStyle.NativePointer);
            }
        }
Esempio n. 3
0
        public void Apply(TextLayout layout)
        {
            if (Enabled)
            {
                var            sc = this.Color;
                SharpDX.Color4 c  = *(SharpDX.Color4 *) & sc;

                if (colorStyle == null)
                {
                    var factory = FontWrapperFactory.GetFactory();
                    colorStyle = factory.CreateColor(c);
                }
                else
                {
                    colorStyle.SetColor(c.Red, c.Green, c.Blue, c.Alpha);
                }


                SharpDX.DirectWrite.TextLayout tl = new SharpDX.DirectWrite.TextLayout(layout.ComPointer);
                tl.SetDrawingEffect(colorStyle.NativePointer, new SharpDX.DirectWrite.TextRange(Range.StartPosition, Range.Length));
            }
        }