本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.BlendState.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# BlendState.Dispose方法的具体用法?C# BlendState.Dispose怎么用?C# BlendState.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.BlendState
的用法示例。
在下文中一共展示了BlendState.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
/// <summary>
/// Draw the Map
/// </summary>
public override void Draw(GameTime gametime)
{
if (_enabled)
{
// Rasterizer: Enable cropping at borders (otherwise map would be overlapping everything else)
RasterizerState rstate = new RasterizerState();
rstate.ScissorTestEnable = true;
// Blendstate used for light circle / fog of war
BlendState blendState = new BlendState();
blendState.AlphaDestinationBlend = Blend.SourceColor;
blendState.ColorDestinationBlend = Blend.SourceColor;
blendState.AlphaSourceBlend = Blend.Zero;
blendState.ColorSourceBlend = Blend.Zero;
// Draw border of window (black square in white square)
_spriteBatch.Begin();
_spriteBatch.Draw(_background, _displayRect, new Rectangle(39, 6, 1, 1), Color.White);
_spriteBatch.Draw(_background, new Rectangle(_displayRect.X + 1, _displayRect.Y + 1, _displayRect.Width - 2, _displayRect.Height - 2), new Rectangle(39, 6, 1, 1), Color.Black);
_spriteBatch.End();
_spriteBatch.Begin(SpriteSortMode.Deferred,
BlendState.AlphaBlend,
null,
null,
rstate,
null,
_camera.matrix);
_spriteBatch.GraphicsDevice.ScissorRectangle = new Rectangle(_displayRect.Left + 5, _displayRect.Top + 5, _displayRect.Width - 10, _displayRect.Height - 10);
_drawFloor(); // Draw the floow
for (int i = 0; i < _projectiles.Count; ++i)
{
_projectiles[i].Draw(_spriteBatch, _environment[1][(int)Math.Log((double)_projectiles[i].direction, 2)]);
}
for (int i = 0; i < _effects.Count; ++i)
{
_effects[i].Draw(_spriteBatch, gametime);
}
_drawWalls(gametime); // Draw walls, other objects, player and enemies
_spriteBatch.End();
// Draw circle of light / fog of war
_spriteBatch.Begin(SpriteSortMode.Texture, blendState, null,
null,
rstate,
null,
_camera.matrix);
_spriteBatch.Draw(_circle, new Rectangle(
(int)(_actors[_playerID].position.x + 1) - 250 * Math.Max(_map.actors[_playerID].viewRange, _map.light),
(int)(_actors[_playerID].position.y + 1) - 250 * Math.Max(_map.actors[_playerID].viewRange, _map.light), 520 * Math.Max(_map.actors[_playerID].viewRange, _map.light), 520 * Math.Max(_map.actors[_playerID].viewRange, _map.light)), Color.White);
_spriteBatch.End();
_spriteBatch.GraphicsDevice.RasterizerState.ScissorTestEnable = false;
rstate.Dispose();
blendState.Dispose();
if ((_highlightedTile.x > -1)
&& (_highlightedTile.x >= _map.actors[_playerID].tile.coords.x - Math.Max(_map.actors[_playerID].viewRange, _map.light))
&& (_highlightedTile.x <= _map.actors[_playerID].tile.coords.x + Math.Max(_map.actors[_playerID].viewRange, _map.light))
&& (_highlightedTile.y >= _map.actors[_playerID].tile.coords.y - Math.Max(_map.actors[_playerID].viewRange, _map.light))
&& (_highlightedTile.y <= _map.actors[_playerID].tile.coords.y + Math.Max(_map.actors[_playerID].viewRange, _map.light)))
_tooltip.DisplayToolTip(_map[_highlightedTile.x, _highlightedTile.y]);
for (int i = 0; i < _floatnumbers.Count; ++i)
{
_floatnumbers[i].Draw();
}
if (_bigText != "")
{
_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
float opacity = ((float)((_visibility <= 0) ? (100 + _visibility) : (_visibility))) / 100f;
_spriteBatch.DrawString(_font, _bigText, new Vector2(_displayRect.Left + 10, _displayRect.Bottom - _font.MeasureString(_bigText).Y - _font.MeasureString(_smallText).Y), new Color(opacity, 0, 0), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
_spriteBatch.DrawString(_font, _smallText, new Vector2(_displayRect.Left + 10, _displayRect.Bottom - _font.MeasureString(_smallText).Y), new Color(opacity, opacity, opacity), 0f, Vector2.Zero, 0.6f, SpriteEffects.None, 1f);
_spriteBatch.End();
}
}
}