当前位置: 首页>>代码示例>>C#>>正文


C# ClassicalSharp.DrawTextArgs类代码示例

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


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


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