• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ClassicalSharp.DrawTextArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ClassicalSharp.DrawTextArgs的典型用法代码示例。如果您正苦于以下问题:C# DrawTextArgs类的具体用法?C# DrawTextArgs怎么用?C# DrawTextArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DrawTextArgs类属于ClassicalSharp命名空间,在下文中一共展示了DrawTextArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DrawBitmappedText

 public override void DrawBitmappedText( ref DrawTextArgs args, int x, int y )
 {
     using( bitmapWrapper ) {
         bitmapWrapper.SetData( curBmp, true, false );
         DrawBitmapTextImpl( bitmapWrapper, ref args, x, y );
     }
 }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:7,代码来源:GdiPlusDrawer2D.Text.cs


示例2: DrawAdvanced

        Texture DrawAdvanced( ref DrawTextArgs args, int index, string text )
        {
            string[] items = Split( index, text );
            Size total = Size.Empty;
            Size[] partSizes = new Size[items.Length];

            for( int i = 0; i < items.Length; i++ ) {
                args.Text = items[i];
                args.Font = (i & 1) == 0 ? font : underlineFont;
                partSizes[i] = game.Drawer2D.MeasureChatSize( ref args );
                total.Height = Math.Max( partSizes[i].Height, total.Height );
                total.Width += partSizes[i].Width;
            }

            using( IDrawer2D drawer = game.Drawer2D )
                using( Bitmap bmp = IDrawer2D.CreatePow2Bitmap( total ) )
            {
                drawer.SetBitmap( bmp );
                int x = 0;

                for( int i = 0; i < items.Length; i++ ) {
                    args.Text = items[i];
                    args.Font = (i & 1) == 0 ? font : underlineFont;
                    Size size = partSizes[i];

                    drawer.DrawChatText( ref args, x, 0 );
                    urlBounds[index][i].X = x;
                    urlBounds[index][i].Width = size.Width;
                    x += size.Width;
                }
                return drawer.Make2DTexture( bmp, total, 0, 0 );
            }
        }
开发者ID:andrewphorn,项目名称:ClassicalSharp,代码行数:33,代码来源:TextGroupWidget.Formatter.cs


示例3: Init

        public override void Init()
        {
            X = 10;
            DrawTextArgs caretArgs = new DrawTextArgs( "_", Color.White, false );
            chatCaretTexture = game.Drawer2D.MakeTextTexture( boldFont, 0, 0, ref caretArgs );
            string value = chatInputText.GetString();

            if( chatInputText.Empty ) {
                caretPos = -1;
            }
            Size size = game.Drawer2D.MeasureSize( value, font, false );

            if( caretPos == -1 ) {
                chatCaretTexture.X1 = 10 + size.Width;
                size.Width += chatCaretTexture.Width;
                DrawString( size, value, true );
            } else {
                string subString = chatInputText.GetSubstring( caretPos );
                Size trimmedSize = game.Drawer2D.MeasureSize( subString, font, false );

                chatCaretTexture.X1 = 10 + trimmedSize.Width;
                Size charSize = game.Drawer2D.MeasureSize( new String( value[caretPos], 1 ), font, false );
                chatCaretTexture.Width = charSize.Width;
                DrawString( size, value, false );
            }
        }
开发者ID:Hetal728,项目名称:ClassicalSharp,代码行数:26,代码来源:TextInputWidget.cs


示例4: DrawClippedText

        public override void DrawClippedText( ref DrawTextArgs args, int x, int y, float maxWidth, float maxHeight )
        {
            if( !args.SkipPartsCheck )
                GetTextParts( args.Text );

            Brush shadowBrush = GetOrCreateBrush( FastColour.Black );
            StringFormatFlags flags = format.FormatFlags;
             			format.FormatFlags |= StringFormatFlags.NoWrap;
            format.Trimming = StringTrimming.EllipsisCharacter;
            float textX = x;

            for( int i = 0; i < parts.Count; i++ ) {
                TextPart part = parts[i];
                Brush textBrush = GetOrCreateBrush( part.TextColour );
                RectangleF rect = new RectangleF( textX + Offset, y + Offset, maxWidth, maxHeight );
                if( args.UseShadow )
                    g.DrawString( part.Text, args.Font, shadowBrush, rect, format );

                rect = new RectangleF( textX, y, maxWidth, maxHeight );
                g.DrawString( part.Text, args.Font, textBrush, rect, format );
                textX += g.MeasureString( part.Text, args.Font, Int32.MaxValue, format ).Width;
            }
            format.Trimming = StringTrimming.None;
            format.FormatFlags = flags;
        }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:25,代码来源:GdiPlusDrawer2D.Text.cs


示例5: DrawChatText

 /// <summary> Draws a string using the specified arguments, using the specified font or 
 /// the current bitmapped font depending on the 'useFont' argument, at the
 /// specified coordinates in the currently bound bitmap. </summary>
 public void DrawChatText( ref DrawTextArgs args, int windowX, int windowY )
 {
     if( !UseBitmappedChat )
         DrawText( ref args, windowX, windowY );
     else
         DrawBitmappedText( ref args, windowX, windowY );
 }
开发者ID:Daribon,项目名称:ClassicalSharp,代码行数:10,代码来源:IDrawer2D.cs


示例6: DrawBitmappedText

        public override void DrawBitmappedText( ref DrawTextArgs args, int x, int y )
        {
            if( !args.SkipPartsCheck )
                GetTextParts( args.Text );

            using( FastBitmap fastBmp = new FastBitmap( curBmp, true ) )
                DrawTextImpl( fastBmp, ref args, x, y );
        }
开发者ID:andrewphorn,项目名称:ClassicalSharp,代码行数:8,代码来源:GdiPlusDrawer2D.TextMC.cs


示例7: InitRenderingData

        protected void InitRenderingData()
        {
            api = game.Graphics;

            using( Font font = new Font( "Arial", 14 ) ) {
                DrawTextArgs args = new DrawTextArgs( DisplayName, font, true );
                nameTex = game.Drawer2D.MakeBitmappedTextTexture( ref args, 0, 0 );
            }
        }
开发者ID:Daribon,项目名称:ClassicalSharp,代码行数:9,代码来源:Player.Rendering.cs


示例8: DrawAt

        public void DrawAt( IDrawer2D drawer, string text, Font font,
            Anchor horAnchor, Anchor verAnchor, int x, int y)
        {
            DrawTextArgs args = new DrawTextArgs( text, font, true );
            Size size = drawer.MeasureSize( ref args );
            Width = size.Width; Height = size.Height;

            CalculateOffset( x, y, horAnchor, verAnchor );
            Redraw( drawer, text, font );
        }
开发者ID:Cheesse,项目名称:ClassicalSharp,代码行数:10,代码来源:LauncherLabelWidget.cs


示例9: Redraw

        public void Redraw( IDrawer2D drawer, string text, Font font )
        {
            DrawTextArgs args = new DrawTextArgs( text, font, true );
            Size size = drawer.MeasureSize( ref args );
            Width = size.Width; Height = size.Height;

            args.SkipPartsCheck = true;
            drawer.DrawText( ref args, X, Y );
            Text = text;
        }
开发者ID:Cheesse,项目名称:ClassicalSharp,代码行数:10,代码来源:LauncherLabelWidget.cs


示例10: SetDrawData

        public void SetDrawData( IDrawer2D drawer, string text, Font font,
            Anchor horAnchor, Anchor verAnchor, int x, int y)
        {
            DrawTextArgs args = new DrawTextArgs( text, font, true );
            Size size = drawer.MeasureSize( ref args );
            Width = size.Width; Height = size.Height;

            CalculateOffset( x, y, horAnchor, verAnchor );
            Text = text;
            this.font = font;
        }
开发者ID:Retatta,项目名称:ClassicalSharp,代码行数:11,代码来源:LauncherLabelWidget.cs


示例11: Init

        public override void Init()
        {
            Textures = new Texture[ElementsCount];
            DrawTextArgs args = new DrawTextArgs( "I", font, true );
            defaultHeight = game.Drawer2D.MeasureSize( ref args ).Height;

            for( int i = 0; i < Textures.Length; i++ ) {
                Textures[i].Height = defaultHeight;
            }
            UpdateDimensions();
        }
开发者ID:Cheesse,项目名称:ClassicalSharp,代码行数:11,代码来源:TextGroupWidget.cs


示例12: DrawBitmapTextImpl

        protected void DrawBitmapTextImpl( FastBitmap dst, ref DrawTextArgs args, int x, int y )
        {
            bool underline = args.Font.Style == FontStyle.Underline;
            if( args.UseShadow ) {
                int offset = ShadowOffset( args.Font.Size );
                DrawPart( dst, ref args, x + offset, y + offset, true );
                if( underline ) DrawUnderline( dst, x + offset, 0, ref args, true );
            }

            DrawPart( dst, ref args, x, y, false );
            if( underline ) DrawUnderline( dst, x, -2, ref args, false );
        }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:12,代码来源:IDrawer2D.TextMC.cs


示例13: Init

        public override void Init()
        {
            Textures = new Texture[ElementsCount];
            lines = new string[ElementsCount];
            urlBounds = new Rectangle[ElementsCount][];
            DrawTextArgs args = new DrawTextArgs( "I", font, true );
            defaultHeight = game.Drawer2D.MeasureChatSize( ref args ).Height;

            for( int i = 0; i < Textures.Length; i++ )
                Textures[i].Height = defaultHeight;
            UpdateDimensions();
        }
开发者ID:andrewphorn,项目名称:ClassicalSharp,代码行数:12,代码来源:TextGroupWidget.cs


示例14: Redraw

 public void Redraw( IDrawer2D drawer )
 {
     drawer.DrawRect( FastColour.Black, X, Y, Width, Height );
     if( Value ) {
         DrawTextArgs args = new DrawTextArgs( "X", font, false );
         Size size = drawer.MeasureSize( ref args );
         args.SkipPartsCheck = true;
         drawer.DrawText( ref args, X + (Width - size.Width) / 2,
                         Y + (Height - size.Height) / 2 );
     }
     drawer.DrawRectBounds( FastColour.White, 2, X, Y, Width, Height );
 }
开发者ID:andrewphorn,项目名称:ClassicalSharp,代码行数:12,代码来源:LauncherBooleanWidget.cs


示例15: MeasureContentSizes

 unsafe void MeasureContentSizes( Element e, Font font, Size* sizes )
 {
     string s = new String( '\0', e.CharsPerItem );
     DrawTextArgs args = new DrawTextArgs( s, font, false );
     // avoid allocating temporary strings here
     fixed( char* ptr = s ) {
         for( int i = 0; i < e.Contents.Length; i += e.CharsPerItem ) {
             for( int j = 0; j < e.CharsPerItem; j++ )
                 ptr[j] = e.Contents[i + j];
             sizes[i / e.CharsPerItem] = game.Drawer2D.MeasureChatSize( ref args );
         }
     }
 }
开发者ID:andrewphorn,项目名称:ClassicalSharp,代码行数:13,代码来源:AltTextInputWidget.Types.cs


示例16: Redraw

 public override void Redraw( IDrawer2D drawer )
 {
     if( Window.Minimised ) return;
     drawer.DrawRect( FastColour.Black, X, Y, Width, Height );
     if( Value ) {
         DrawTextArgs args = new DrawTextArgs( "X", font, false );
         Size size = drawer.MeasureSize( ref args );
         args.SkipPartsCheck = true;
         drawer.DrawText( ref args, X + (Width + 2 - size.Width) / 2, // account for border
                         Y + (Height - size.Height) / 2 );
     }
     drawer.DrawRectBounds( FastColour.White, 2, X, Y, Width, Height );
 }
开发者ID:Retatta,项目名称:ClassicalSharp,代码行数:13,代码来源:LauncherBoolWidget.cs


示例17: Redraw

        public override void Redraw( IDrawer2D drawer )
        {
            if( Window.Minimised ) return;
            string text = Text;
            if( !Active ) text = "&7" + text;
            int xOffset = Width - textSize.Width, yOffset = Height - textSize.Height;
            DrawTextArgs args = new DrawTextArgs( text, font, true );

            DrawBorder( drawer );
            if( Window.ClassicBackground ) DrawClassic( drawer );
            else DrawNormal( drawer );

            drawer.DrawText( ref args, X + xOffset / 2, Y + yOffset / 2 );
        }
开发者ID:Retatta,项目名称:ClassicalSharp,代码行数:14,代码来源:LauncherButtonWidget.cs


示例18: MakeTextTexture

        /// <summary> Draws the specified string from the arguments into a new bitmap,
        /// them creates a 2D texture with origin at the specified window coordinates. </summary>
        public Texture MakeTextTexture( ref DrawTextArgs args, int windowX, int windowY )
        {
            Size size = MeasureSize( ref args );
            if( parts.Count == 0 )
                return new Texture( -1, windowX, windowY, 0, 0, 1, 1 );

            using( Bitmap bmp = CreatePow2Bitmap( size ) ) {
                SetBitmap( bmp );
                args.SkipPartsCheck = true;

                DrawText( ref args, 0, 0 );
                Dispose();
                return Make2DTexture( bmp, size, windowX, windowY );
            }
        }
开发者ID:Cheesse,项目名称:ClassicalSharp,代码行数:17,代码来源:IDrawer2D.cs


示例19: MakeTextTexture

        public Texture MakeTextTexture( Font font, int screenX, int screenY, ref DrawTextArgs args )
        {
            Size size = MeasureSize( args.Text, font, args.UseShadow );
            if( parts.Count == 0 )
                return new Texture( -1, screenX, screenY, 0, 0, 1, 1 );

            using( Bitmap bmp = CreatePow2Bitmap( size ) ) {
                SetBitmap( bmp );
                args.SkipPartsCheck = true;

                DrawText( font, ref args, 0, 0 );
                Dispose();
                return Make2DTexture( bmp, size, screenX, screenY );
            }
        }
开发者ID:lavajoe,项目名称:ClassicalSharp,代码行数:15,代码来源:IDrawer2D.cs


示例20: DrawTitles

        void DrawTitles( IDrawer2D drawer, Font font )
        {
            int x = 0;
            DrawTextArgs args = new DrawTextArgs( null, font, false );
            for( int i = 0; i < elements.Length; i++ ) {
                args.Text = elements[i].Title;
                FastColour col = i == selectedIndex ? new FastColour( 30, 30, 30, 200 ) :
                    new FastColour( 60, 60, 60, 200 );
                Size size = elements[i].TitleSize;

                drawer.Clear( col, x, 0, size.Width, size.Height );
                drawer.DrawChatText( ref args, x + titleSpacing / 2, 0 );
                x += size.Width;
            }
        }
开发者ID:andrewphorn,项目名称:ClassicalSharp,代码行数:15,代码来源:AltTextInputWidget.Types.cs



注:本文中的ClassicalSharp.DrawTextArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ClassicalSharp.Game类代码示例发布时间:2022-05-24
下一篇:
C# Classes.Player类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap