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


C# SpriteBatch.SetColor方法代码示例

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


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

示例1: Draw

		public void Draw(int idx, SpriteBatch batch, float x, float y,
				float rotation, float sx, float sy, LColor color) {
			RectBox rect = this._rectList[idx];
			batch.SetColor(color);
			batch.Draw(_texture, x, y, anchor.x, anchor.y, rect.width, rect.height,
					sx, sy, MathUtils.ToDegrees(rotation), rect.x, rect.y,
					rect.width, rect.height, false, false);
			batch.ResetColor();
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:9,代码来源:LNTextureAtlas.cs

示例2: Draw

		public override void Draw(SpriteBatch batch) {
			if (base._visible) {
				pos = base.ConvertToWorldPos();
				scale = base.ConvertToWorldScale();
				rotation = base.ConvertToWorldRot();
				batch.SetColor(base._color.r, base._color.g, base._color.b,
						base._alpha);
				LFont font = batch.GetFont();
				batch.SetFont(_spriteFont);
				batch.DrawString(this._text, pos[0], pos[1], scale[0], scale[1],
						_anchor.x, _anchor.y, MathUtils.ToDegrees(rotation),
						batch.GetColor());
				batch.SetFont(font);
				batch.ResetColor();
			}
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:16,代码来源:LNLabel.cs

示例3: Draw

		public override void Draw(SpriteBatch batch) {
			if (base._visible && (base._texture != null)) {
				pos = base.ConvertToWorldPos();
				rotation = base.ConvertToWorldRot();
				scale = base.ConvertToWorldScale();
				batch.SetColor(base._color.r, base._color.g, base._color.b,
						base._alpha);
				if (this._type == BarType.PROGRESS_BAR_LEFT) {
					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 * this._percent,
							base._orig_height, _flipX, _flipY);
				} else if (this._type == BarType.PROGRESS_BAR_RIGHT) {
					int offsetX = ((int) (base._orig_width * (1f - this._percent)));
					batch.Draw(_texture, pos[0] + offsetX, pos[1], _anchor.x,
							_anchor.y, base._size_width, base._size_height,
							scale[0], scale[1], MathUtils.ToDegrees(rotation),
							((int) base._left) + offsetX, (int) base._top,
							(int) (base._orig_width * this._percent),
							(int) base._orig_height, _flipX, _flipY);
				} else if (this._type == BarType.PROGRESS_BAR_TOP) {
                    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 * this._percent), _flipX, _flipY);
				} else if (this._type == BarType.PROGRESS_BAR_BOTTOM) {
					int offsetY = ((int) (base._orig_height * (1f - this._percent)));
                    batch.Draw(_texture, pos[0], pos[1] + offsetY, _anchor.x,
							_anchor.y, base._size_width, base._size_height,
							scale[0], scale[1], MathUtils.ToDegrees(rotation),
							(int) base._left, ((int) base._top)
									+ ((int) (base._orig_height * this._percent)),
							(int) base._orig_width,
							(int) (base._orig_height * this._percent), _flipX,
							_flipY);
	
				}
				batch.ResetColor();
			}
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:42,代码来源:LNProgressBar.cs

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