亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? d3dfont.cs

?? Particle System Test Application on C#
?? CS
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):

    /// <summary>
    /// Draw some text on the screen
    /// </summary>
    public void DrawText(float xpos, float ypos, Color color, string text, RenderFlags flags)
    {
        if (text == null)
            return;

        // Setup renderstate
        savedStateBlock.Capture();
        drawTextStateBlock.Apply();
        device.SetTexture(0, fontTexture);
        device.VertexFormat = CustomVertex.TransformedColoredTextured.Format;
        device.PixelShader = null;
        device.SetStreamSource(0, vertexBuffer, 0);

        // Set filter states
        if ((flags & RenderFlags.Filtered) != 0)
        {
            samplerState0.MinFilter = TextureFilter.Linear;
            samplerState0.MagFilter = TextureFilter.Linear;
        }

        // Adjust for character spacing
        xpos -= spacingPerChar;
        float fStartX = xpos;

        // Fill vertex buffer
        int iv = 0;
        int dwNumTriangles = 0;

        foreach (char c in text)
        {
            if (c == '\n')
            {
                xpos = fStartX;
                ypos += (textureCoords[0,3]-textureCoords[0,1])*textureHeight;
            }

            if ((c-32) < 0 || (c-32) >= 128-32)
                continue;

            float tx1 = textureCoords[c-32,0];
            float ty1 = textureCoords[c-32,1];
            float tx2 = textureCoords[c-32,2];
            float ty2 = textureCoords[c-32,3];

            float w = (tx2-tx1) *  textureWidth / textureScale;
            float h = (ty2-ty1) * textureHeight / textureScale;

            int intColor = color.ToArgb();
            if (c != ' ')
            {
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+h-0.5f,0.9f,1.0f), intColor, tx1, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,0.9f,1.0f), intColor, tx1, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,0.9f,1.0f), intColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+0-0.5f,0.9f,1.0f), intColor, tx2, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,0.9f,1.0f), intColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,0.9f,1.0f), intColor, tx1, ty1);
                dwNumTriangles += 2;

                if (dwNumTriangles*3 > (MaxNumfontVertices-6))
                {
                    // Set the data for the vertexbuffer
                    vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, dwNumTriangles);
                    dwNumTriangles = 0;
                    iv = 0;
                }
            }

            xpos += w - (2 * spacingPerChar);
        }

        // Set the data for the vertex buffer
        vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
        if (dwNumTriangles > 0)
            device.DrawPrimitives(PrimitiveType.TriangleList, 0, dwNumTriangles);

        // Restore the modified renderstates
        savedStateBlock.Apply();
    }




    /// <summary>
    /// Draws scaled 2D text.  Note that x and y are in viewport coordinates
    /// (ranging from -1 to +1).  fXScale and fYScale are the size fraction 
    /// relative to the entire viewport.  For example, a fXScale of 0.25 is
    /// 1/8th of the screen width.  This allows you to output text at a fixed
    /// fraction of the viewport, even if the screen or window size changes.
    /// </summary>
    public void DrawTextScaled(float x, float y, float z, 
                               float fXScale, float fYScale, 
                               System.Drawing.Color color,
                               string text, RenderFlags flags)
    {
        if (device == null)
            throw new System.ArgumentNullException();

        // Set up renderstate
        savedStateBlock.Capture();
        drawTextStateBlock.Apply();
        device.VertexFormat = CustomVertex.TransformedColoredTextured.Format;
        device.PixelShader = null;
        device.SetStreamSource(0, vertexBuffer, 0);

        // Set filter states
        if ((flags & RenderFlags.Filtered) != 0)
        {
            samplerState0.MinFilter = TextureFilter.Linear;
            samplerState0.MagFilter = TextureFilter.Linear;
        }

        Viewport vp = device.Viewport;
        float xpos = (x+1.0f)*vp.Width/2;
        float ypos = (y+1.0f)*vp.Height/2;
        float sz = z;
        float rhw = 1.0f;
        float fLineHeight = (textureCoords[0,3] - textureCoords[0,1]) * textureHeight;

        // Adjust for character spacing
        xpos -= spacingPerChar * (fXScale*vp.Height)/fLineHeight;
        float fStartX = xpos;

        // Fill vertex buffer
        int numTriangles = 0;
        int realColor = color.ToArgb();
        int iv = 0;

        foreach (char c in text)
        {
            if (c == '\n')
            {
                xpos  = fStartX;
                ypos += fYScale*vp.Height;
            }

            if ((c-32) < 0 || (c-32) >= 128-32)
                continue;

            float tx1 = textureCoords[c-32,0];
            float ty1 = textureCoords[c-32,1];
            float tx2 = textureCoords[c-32,2];
            float ty2 = textureCoords[c-32,3];

            float w = (tx2-tx1)*textureWidth;
            float h = (ty2-ty1)*textureHeight;

            w *= (fXScale*vp.Height)/fLineHeight;
            h *= (fYScale*vp.Height)/fLineHeight;

            if (c != ' ')
            {
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+h-0.5f,sz,rhw), realColor, tx1, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,sz,rhw), realColor, tx1, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,sz,rhw), realColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+0-0.5f,sz,rhw), realColor, tx2, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,sz,rhw), realColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,sz,rhw), realColor, tx1, ty1);
                numTriangles += 2;

                if (numTriangles*3 > (MaxNumfontVertices-6))
                {
                    // Unlock, render, and relock the vertex buffer
                    vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
                    device.DrawPrimitives(PrimitiveType.TriangleList , 0, numTriangles);
                    numTriangles = 0;
                    iv = 0;
                }
            }

            xpos += w - (2 * spacingPerChar) * (fXScale*vp.Height)/fLineHeight;
        }

        // Unlock and render the vertex buffer
        vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
        if (numTriangles > 0)
            device.DrawPrimitives(PrimitiveType.TriangleList , 0, numTriangles);

        // Restore the modified renderstates
        savedStateBlock.Apply();
    }




    /// <summary>
    /// Draws scaled 2D text.  Note that x and y are in viewport coordinates
    /// (ranging from -1 to +1).  fXScale and fYScale are the size fraction 
    /// relative to the entire viewport.  For example, a fXScale of 0.25 is
    /// 1/8th of the screen width.  This allows you to output text at a fixed
    /// fraction of the viewport, even if the screen or window size changes.
    /// </summary>
    public void DrawTextScaled(float x, float y, float z, 
                               float fXScale, float fYScale, 
                               System.Drawing.Color color,
                               string text)
    {
        this.DrawTextScaled(x,y,z,fXScale, fYScale, color, text, 0);
    }




    /// <summary>
    /// Renders 3D text
    /// </summary>
    public void Render3DText(string text, RenderFlags flags)
    {
        if (device == null)
            throw new System.ArgumentNullException();

        // Set up renderstate
        savedStateBlock.Capture();
        drawTextStateBlock.Apply();
        device.VertexFormat = CustomVertex.PositionNormalTextured.Format;
        device.PixelShader = null;
        device.SetStreamSource(0, vertexBuffer, 0, VertexInformation.GetFormatSize(CustomVertex.PositionNormalTextured.Format));

        // Set filter states
        if ((flags & RenderFlags.Filtered) != 0)
        {
            samplerState0.MinFilter = TextureFilter.Linear;
            samplerState0.MagFilter = TextureFilter.Linear;
        }

        // Position for each text element
        float x = 0.0f;
        float y = 0.0f;

        // Center the text block at the origin
        if ((flags & RenderFlags.Centered) != 0)
        {
            System.Drawing.SizeF sz = GetTextExtent(text);
            x = -(((float)sz.Width)/10.0f)/2.0f;
            y = -(((float)sz.Height)/10.0f)/2.0f;
        }

        // Turn off culling for two-sided text
        if ((flags & RenderFlags.TwoSided) != 0)
            renderState.CullMode = Cull.None;

        // Adjust for character spacing
        x -= spacingPerChar / 10.0f;
        float fStartX = x;

        // Fill vertex buffer
        GraphicsStream strm = vertexBuffer.Lock(0, 0, LockFlags.Discard);
        int numTriangles = 0;

        foreach (char c in text)
        {
            if (c == '\n')
            {
                x = fStartX;
                y -= (textureCoords[0,3]-textureCoords[0,1])*textureHeight/10.0f;
            }

            if ((c-32) < 0 || (c-32) >= 128-32)
                continue;

            float tx1 = textureCoords[c-32,0];
            float ty1 = textureCoords[c-32,1];
            float tx2 = textureCoords[c-32,2];
            float ty2 = textureCoords[c-32,3];

            float w = (tx2-tx1) * textureWidth  / (10.0f * textureScale);
            float h = (ty2-ty1) * textureHeight / (10.0f * textureScale);

            if (c != ' ')
            {
                strm.Write(new CustomVertex.PositionNormalTextured(new Vector3(x+0,y+0,0), new Vector3(0,0,-1), tx1, ty2));
                strm.Write(new CustomVertex.PositionNormalTextured(new Vector3(x+0,y+h,0), new Vector3(0,0,-1), tx1, ty1));
                strm.Write(new CustomVertex.PositionNormalTextured(new Vector3(x+w,y+0,0), new Vector3(0,0,-1), tx2, ty2));
                strm.Write(new CustomVertex.PositionNormalTextured(new Vector3(x+w,y+h,0), new Vector3(0,0,-1), tx2, ty1));
                strm.Write(new CustomVertex.PositionNormalTextured(new Vector3(x+w,y+0,0), new Vector3(0,0,-1), tx2, ty2));
                strm.Write(new CustomVertex.PositionNormalTextured(new Vector3(x+0,y+h,0), new Vector3(0,0,-1), tx1, ty1));
                numTriangles += 2;

                if (numTriangles*3 > (MaxNumfontVertices-6))
                {
                    // Unlock, render, and relock the vertex buffer
                    vertexBuffer.Unlock();
                    device.DrawPrimitives(PrimitiveType.TriangleList , 0, numTriangles);
                    strm = vertexBuffer.Lock(0, 0, LockFlags.Discard);
                    numTriangles = 0;
                }
            }

            x += w - (2 * spacingPerChar) / 10.0f;
        }

        // Unlock and render the vertex buffer
        vertexBuffer.Unlock();
        if (numTriangles > 0)
            device.DrawPrimitives(PrimitiveType.TriangleList , 0, numTriangles);

        // Restore the modified renderstates
        savedStateBlock.Apply();
    }




    /// <summary>
    /// Get the dimensions of a text string
    /// </summary>
    private System.Drawing.SizeF GetTextExtent(string text)
    {
        if (null == text || text == string.Empty)
            throw new System.ArgumentNullException();

        float fRowWidth  = 0.0f;
        float fRowHeight = (textureCoords[0,3]-textureCoords[0,1])*textureHeight;
        float fWidth     = 0.0f;
        float fHeight    = fRowHeight;

        foreach (char c in text)
        {
            if (c == '\n')
            {
                fRowWidth = 0.0f;
                fHeight  += fRowHeight;
            }

            if ((c-32) < 0 || (c-32) >= 128-32)
                continue;

            float tx1 = textureCoords[c-32,0];
            float tx2 = textureCoords[c-32,2];

            fRowWidth += (tx2-tx1)*textureWidth - 2*spacingPerChar;

            if (fRowWidth > fWidth)
                fWidth = fRowWidth;
        }

        return new System.Drawing.SizeF(fWidth, fHeight);
    }




    /// <summary>
    /// Cleanup any resources being used
    /// </summary>
    public void Dispose(object sender, EventArgs e)
    {
        if (systemFont != null)
            systemFont.Dispose();

        systemFont = null;
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久91精品久久久久久秒播| 亚洲日本韩国一区| 日韩电影在线观看网站| 久久综合九色综合欧美98 | 亚洲国产aⅴ成人精品无吗| 色猫猫国产区一区二在线视频| 亚洲欧洲性图库| 91久久一区二区| 天天av天天翘天天综合网| 欧美福利电影网| 久久99热这里只有精品| 亚洲精品一区二区三区蜜桃下载 | 亚洲激情成人在线| 欧洲精品在线观看| 视频一区在线视频| 久久婷婷国产综合精品青草| 成人高清免费在线播放| 亚洲综合色噜噜狠狠| 欧美一区永久视频免费观看| 国产福利91精品一区二区三区| 国产精品成人免费精品自在线观看| 色伊人久久综合中文字幕| 日韩精品成人一区二区三区| 国产日本一区二区| 欧美系列日韩一区| 喷白浆一区二区| 亚洲国产精品精华液2区45| 欧美综合亚洲图片综合区| 欧美aaaaaa午夜精品| 中文字幕乱码亚洲精品一区| 欧美视频精品在线观看| 国产一区二区三区视频在线播放| 国产精品国产自产拍高清av| 欧美日韩精品一区视频| 国产一区二区精品久久99| 亚洲欧美日韩国产综合在线| 欧美一区二区三区人| 成人app下载| 美洲天堂一区二卡三卡四卡视频 | 国产天堂亚洲国产碰碰| 色婷婷狠狠综合| 精品一区二区三区免费观看| 亚洲精品乱码久久久久久久久 | 一区二区三区成人| 日韩一区二区三区高清免费看看| 成人激情文学综合网| 蜜臀av在线播放一区二区三区 | 天天操天天色综合| 国产精品免费视频观看| 欧美一区二区高清| 欧美在线看片a免费观看| 国内外成人在线视频| 亚洲午夜影视影院在线观看| 国产日韩av一区二区| 欧美日韩的一区二区| 成人激情开心网| 日本在线不卡视频一二三区| 久久亚洲二区三区| 在线观看成人小视频| 不卡在线视频中文字幕| 国产一区二区精品久久91| 首页欧美精品中文字幕| 亚洲欧美激情插 | 欧美在线观看视频一区二区三区| 国产成人一区在线| 美女视频第一区二区三区免费观看网站| 亚洲美女视频在线观看| 国产欧美一区视频| 精品欧美久久久| 欧美一区二区三区在线观看视频| 91视频免费看| 岛国av在线一区| 国产资源在线一区| 免费精品视频在线| 琪琪久久久久日韩精品| 天天综合日日夜夜精品| 亚洲国产精品一区二区www| 亚洲色图视频免费播放| 国产精品午夜在线| 国产精品美女久久久久av爽李琼| 国产三级精品在线| 亚洲一区二区影院| 自拍偷拍亚洲欧美日韩| 欧美经典一区二区三区| 久久精品人人爽人人爽| 久久一区二区三区四区| 久久欧美一区二区| 国产欧美精品一区二区色综合朱莉| 欧美tk—视频vk| 日韩免费视频一区二区| 精品日韩一区二区三区免费视频| 欧美一区二区性放荡片| 欧美变态tickling挠脚心| 成人一区二区三区在线观看| 成人午夜精品一区二区三区| 成人h精品动漫一区二区三区| 成人黄色电影在线 | 欧美一级片在线| 日韩欧美在线网站| 日韩女同互慰一区二区| 2020日本不卡一区二区视频| 久久久国产精品不卡| 国产精品美女久久久久av爽李琼| 亚洲视频一二三| 午夜一区二区三区视频| 久久国产成人午夜av影院| 国产麻豆欧美日韩一区| 成人精品国产福利| 色丁香久综合在线久综合在线观看| 欧美在线|欧美| 日韩一级完整毛片| 国产精品五月天| 夜夜精品视频一区二区| 午夜视频在线观看一区| 国产一区二区三区最好精华液| 国产精品一区不卡| 色婷婷综合久久| 在线播放中文字幕一区| 久久午夜免费电影| 亚洲精品视频一区| 石原莉奈在线亚洲三区| 国产精品影视在线| 一本色道久久加勒比精品| 欧美一区二区三区免费在线看| 亚洲精品一区二区三区蜜桃下载| 日韩理论片中文av| 日韩精品乱码免费| 国产成人av一区二区| 欧美日韩和欧美的一区二区| 精品人在线二区三区| 亚洲啪啪综合av一区二区三区| 日韩精品高清不卡| 97国产一区二区| 日韩欧美精品三级| 亚洲欧美在线视频| 视频一区二区三区在线| 99久久精品免费看| 精品精品国产高清a毛片牛牛| 专区另类欧美日韩| 久88久久88久久久| 欧美在线观看视频一区二区三区| 亚洲精品午夜久久久| 韩日欧美一区二区三区| 欧美日韩亚洲综合| 成人欧美一区二区三区白人| 美腿丝袜亚洲色图| 日本韩国一区二区三区| 国产午夜精品久久久久久免费视| 肉丝袜脚交视频一区二区| 91免费国产在线| 国产亚洲精品bt天堂精选| 午夜亚洲国产au精品一区二区| gogo大胆日本视频一区| 欧美va亚洲va香蕉在线| 五月激情综合婷婷| 91黄色小视频| 国产精品蜜臀在线观看| 蜜桃精品视频在线| 欧美老肥妇做.爰bbww视频| 国产精品久久精品日日| 国产精品亚洲第一区在线暖暖韩国| 91精品欧美综合在线观看最新| 亚洲精品日韩综合观看成人91| 成人毛片老司机大片| 精品电影一区二区| 日日夜夜免费精品| 欧美日韩在线精品一区二区三区激情 | 国产老妇另类xxxxx| 日韩欧美国产不卡| 日韩激情视频在线观看| 欧美日韩国产精品成人| 亚洲最大色网站| 99久久国产免费看| 中文字幕制服丝袜成人av | 同产精品九九九| 91论坛在线播放| 国产精品久久久久影视| 国产不卡视频在线观看| 久久久99精品久久| 国产suv精品一区二区6| 国产亚洲1区2区3区| 国产福利一区在线| 久久久精品日韩欧美| 国产伦精品一区二区三区免费| 精品久久久久香蕉网| 久久国产欧美日韩精品| 欧美va亚洲va| 国产一区二区中文字幕| 久久精品免视看| 国产精品亚洲综合一区在线观看| 久久免费看少妇高潮| 国产精品夜夜爽| 中文字幕一区二区三区四区不卡 | 久久成人免费网站| 精品国产3级a| 丁香六月综合激情| 国产精品激情偷乱一区二区∴| 91热门视频在线观看| 懂色av一区二区三区蜜臀| 欧美高清在线一区|