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


C# Renderer.DrawGlyph方法代码示例

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


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

示例1: DrawControl

    ////////////////////////////////////////////////////////////////////////////
    
    ////////////////////////////////////////////////////////////////////////////
    protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
    {                    

      if (mode == ButtonMode.PushButton && pushed)
      {
        SkinLayer l = Skin.Layers[lrButton];
        renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index);
        if (l.States.Pressed.Overlay)
        {
          renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index);          
        }                
      }
      else
      {
        base.DrawControl(renderer, rect, gameTime);
      }
    
      SkinLayer layer = Skin.Layers[lrButton];                                  
      SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
      Color col = Color.White;              
      int ox = 0; int oy = 0;
    
      if (ControlState == ControlState.Pressed)
      {       
        if (layer.Text != null) col = layer.Text.Colors.Pressed;
        ox = 1; oy = 1;
      }                               
      if (glyph != null)
      {
        Margins cont = layer.ContentMargins;
        Rectangle r = new Rectangle(rect.Left + cont.Left, 
                                    rect.Top + cont.Top, 
                                    rect.Width - cont.Horizontal, 
                                    rect.Height - cont.Vertical);
        renderer.DrawGlyph(glyph, r);
      }
      else 
      {
        renderer.DrawString(this, layer, Text, rect, true, ox, oy);
      }       
    }
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:44,代码来源:Button.cs

示例2: DrawControl

        /// <summary>
        /// Draws the button control.
        /// </summary>
        /// <param name="renderer">Rendering management object.</param>
        /// <param name="rect">Destination rectangle.</param>
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            // Toggle button in pressed state?
            if (mode == ButtonMode.PushButton && pushed)
            {
                SkinLayer l = Skin.Layers[lrButton];
                renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index);

                // Does the layer's pressed state have an overlay?
                if (l.States.Pressed.Overlay)
                {
                    // Draw the overlay on top of the button.
                    renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index);
                }
            }

            else
            {
                // Standard button. ButtonBase can handle drawing.
                base.DrawControl(renderer, rect, gameTime);
            }

            SkinLayer layer = Skin.Layers[lrButton];
            SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
            Color col = Color.White;
            int ox = 0; int oy = 0;

            // Standard button pressed?
            if (ControlState == ControlState.Pressed)
            {
                if (layer.Text != null) col = layer.Text.Colors.Pressed;
                ox = 1; oy = 1;
            }

            // Button has an image to apply?
            if (glyph != null)
            {
                // Draw the button image.
                Margins cont = layer.ContentMargins;
                Rectangle r = new Rectangle(rect.Left + cont.Left,
                                            rect.Top + cont.Top,
                                            rect.Width - cont.Horizontal,
                                            rect.Height - cont.Vertical);
                renderer.DrawGlyph(glyph, r);
            }

            else
            {
                // Draw the button text.
                renderer.DrawString(this, layer, Text, rect, true, ox, oy);
            }
        }
开发者ID:Rfvgyhn,项目名称:Neoforce,代码行数:58,代码来源:Button.cs


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