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


C# SpriteBatch.SetBlendState方法代码示例

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


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

示例1: Draw

		public override void Draw(SpriteBatch batch) {
			if (base._visible && (this._texture != null)) {
				pos = base.ConvertToWorldPos();
				if (_screenRect.Intersects(pos[0], pos[1], GetWidth(), GetHeight())
						|| _screenRect.Contains(pos[0], pos[1])) {
					if (_parent != null) {
						rotation = ConvertToWorldRot();
						scale = ConvertToWorldScale();
					} else {
						rotation = _rotation;
						scale[0] = _scale.x;
						scale[1] = _scale.y;
					}
					batch.SetColor(base._color.r, base._color.g, base._color.b,
							base._alpha);
					if (rotation == 0) {
						batch.Draw(_texture, pos[0], pos[1], base._size_width
								* scale[0], base._size_height * scale[1],
								base._left, base._top, base._orig_width,
								base._orig_height, _flipX, _flipY);
					} else {
						batch.Draw(_texture, pos[0], pos[1], _anchor.x, _anchor.y,
								base._size_width, base._size_height, scale[0],
								scale[1], MathUtils.ToDegrees(rotation),
								base._left, base._top, base._orig_width,
								base._orig_height, _flipX, _flipY);
					}
					batch.ResetColor();
					BlendState oldState = batch.GetBlendState();
					if (blendState != oldState) {
						batch.Flush(blendState);
						batch.SetBlendState(oldState);
					}
				}
			}
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:36,代码来源:LNSprite.cs


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