DrawSprite() public method

public DrawSprite ( EffectState effect, Microsoft.Xna.Framework.Graphics.Texture2D texture, Microsoft.Xna.Framework.Vector3 position, Vector2 area, Microsoft.Xna.Framework.Color hue ) : bool
effect EffectState
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Microsoft.Xna.Framework.Vector3
area Microsoft.Xna.Framework.Vector2
hue Microsoft.Xna.Framework.Color
return bool
示例#1
0
文件: Curses.cs 项目: pabru/YCPU
        public void Render(SpriteBatchExtended spriteBatch, EffectState effect, Vector2 offset)
        {
            const float sixteenth   = 1 / 16f;
            float       horizSpacer = m_AdditionalHorizSpacingPixel ? 1f : 0f;

            for (int y = 0; y < CharsHigh; y++)
            {
                for (int x = 0; x < CharsWide; x++)
                {
                    byte ch = m_CharBuffer[x + y * CharsWide];
                    if (ch == 0)
                    {
                        continue;
                    }
                    float u = ch % 16 * sixteenth;
                    float v = ch / 16 * sixteenth;
                    spriteBatch.DrawSprite(effect, m_Texture,
                                           new Vector3(offset.X + x * (OneCharWidth + horizSpacer), offset.Y + y * OneCharHeight, 0),
                                           new Vector2(OneCharWidth, OneCharHeight),
                                           new Vector4(u, v, u + sixteenth, v + sixteenth),
                                           Color.LightGray);
                }
            }
        }
示例#2
0
文件: Curses.cs 项目: ZaneDubya/YCPU
 public void Render(SpriteBatchExtended spriteBatch, EffectState effect, Vector2 offset)
 {
     const float sixteenth = 1 / 16f;
     float horizSpacer = m_AdditionalHorizSpacingPixel ? 1f : 0f;
     for (int y = 0; y < CharsHigh; y++) {
         for (int x = 0; x < CharsWide; x++) {
             byte ch = m_CharBuffer[x + y * CharsWide];
             if (ch == 0)
                 continue;
             float u = ch % 16 * sixteenth;
             float v = ch / 16 * sixteenth;
             spriteBatch.DrawSprite(effect, m_Texture,
                 new Vector3(offset.X + x * (OneCharWidth + horizSpacer), offset.Y + y * OneCharHeight, 0),
                 new Vector2(OneCharWidth, OneCharHeight),
                 new Vector4(u, v, u + sixteenth, v + sixteenth),
                 Color.LightGray);
         }
     }
 }