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


C# SdlDotNet.Render方法代码示例

本文整理汇总了C#中SdlDotNet.Render方法的典型用法代码示例。如果您正苦于以下问题:C# SdlDotNet.Render方法的具体用法?C# SdlDotNet.Render怎么用?C# SdlDotNet.Render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SdlDotNet的用法示例。


在下文中一共展示了SdlDotNet.Render方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawText

 public static void DrawText(RendererDestinationData destData, SdlDotNet.Graphics.Font font, string text, Color textColor, Point destinationPosition)
 {
     Surface textSurface = font.Render(text, textColor);
     destData.Blit(textSurface, destinationPosition);
     textSurface.Close();
 }
开发者ID:blastboy,项目名称:Client,代码行数:6,代码来源:TextRenderer.cs

示例2: DrawText

 public void DrawText(SdlDotNet.Graphics.Font font, string text, Color textColor, Color backgroundColor, Point destinationPosition)
 {
     SdlVideo.Screen.Blit(font.Render(text, textColor, backgroundColor), destinationPosition);
 }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:4,代码来源:DrawingCore.cs

示例3: CreateMultilineStringSurface

        public static Surface CreateMultilineStringSurface(string[] lines, SdlDotNet.Graphics.Font font, Color c, TextAlign align)
        {
            Surface[] ts = new Surface[lines.Length];
            int idx = 0;
            int w = 0;
            int y = 0;
            int fh = (int)(font.Height * Constants.LineHeight);
            foreach (string line in lines)
            {
                if (!string.IsNullOrEmpty(line))
                {
                    ts[idx] = font.Render(line, c, true);
                    ts[idx].AlphaBlending = true;
                    if (w < ts[idx].Width) w = ts[idx].Width;
                }
                idx++;
                y += fh;
            }
            if (w <= 0 || y <= 0) return null;

            Surface ret = new Surface(w, y);
            y = 0;
            foreach (Surface s in ts)
            {
                if (s != null)
                {
                    int x = 0;
                    switch (align)
                    {
                        case TextAlign.Left:
                            x = 0;
                            break;
                        case TextAlign.Center:
                            x = (int)(w / 2.0 - s.Width / 2.0);
                            break;
                        case TextAlign.Right:
                            x = w - s.Width;
                            break;
                    }
                    ret.Blit(s, new Point(x, y));
                }
                y += fh;
            }
            foreach (Surface s in ts) if (s != null) s.Dispose();
            return ret;
        }
开发者ID:davinx,项目名称:PitchPitch,代码行数:46,代码来源:Utilities.cs

示例4: DrawMultilineString

 public static void DrawMultilineString(Surface s, string[] lines, SdlDotNet.Graphics.Font font, Color c, Point p)
 {
     int y = p.Y;
     int fh = (int)(font.Height * Constants.LineHeight);
     foreach (string line in lines)
     {
         if (!string.IsNullOrEmpty(line))
         {
             using (Surface ts = font.Render(line, c))
             {
                 s.Blit(ts, new Point(p.X, y));
             }
         }
         y += fh;
     }
 }
开发者ID:davinx,项目名称:PitchPitch,代码行数:16,代码来源:Utilities.cs

示例5: CreateStrMenu

 public static void CreateStrMenu(string[] items, Color c, SdlDotNet.Graphics.Font font, ref SurfaceCollection surfaces, ref Rectangle[] rects, int width = 300, int height = 30)
 {
     int y = 0; int idx = 0;
     if (height < 0) height = (int)(font.Height * Constants.MenuLineHeight);
     foreach (string mi in items)
     {
         Surface s = font.Render(mi, c, true);
         surfaces.Add(s);
         Rectangle r = new Rectangle(0, y, width, height);
         y = r.Bottom;
         rects[idx++] = r;
     }
 }
开发者ID:davinx,项目名称:PitchPitch,代码行数:13,代码来源:Utilities.cs

示例6: TextSprite

 /// <summary>
 /// Creates a new TextSprite given the text, font, color, anti-aliasing flag and position.
 /// </summary>
 /// <param name="textItem">Text to display</param>
 /// <param name="font">The font to use when rendering.</param>
 /// <param name="color">Color of Text</param>
 /// <param name="antiAlias">A flag determining if it's to use anti-aliasing when rendering. Defaults to true.</param>
 /// <param name="position">Position of Sprite</param>
 public TextSprite(
     string textItem,
     SdlDotNet.Graphics.Font font,
     Color color,
     bool antiAlias,
     Point position)
     : base()
 {
     if (font == null)
     {
         throw new ArgumentNullException("font");
     }
     base.Surface = font.Render(textItem, color);
     this.textItem = textItem;
     this.font = font;
     this.color = color;
     this.antiAlias = antiAlias;
     base.Position = position;
     this.RenderInternal();
 }
开发者ID:Blizz9,项目名称:FanCut,代码行数:28,代码来源:TextSprite.cs


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