本文整理汇总了C#中RenderTarget.MapPixelToCoords方法的典型用法代码示例。如果您正苦于以下问题:C# RenderTarget.MapPixelToCoords方法的具体用法?C# RenderTarget.MapPixelToCoords怎么用?C# RenderTarget.MapPixelToCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderTarget
的用法示例。
在下文中一共展示了RenderTarget.MapPixelToCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(RenderTarget target, RenderStates states)
{
target.Clear(Color.Black);
target.SetView(_view);
_game._mouseLight.SetPosition(target.MapPixelToCoords(InputHandler.MousePosition));
_game.Map.Draw(target, states);
if (_fpsToggle)
_msFLabel.Draw(target, states);
}
示例2: DrawBufferToTarget
/// <summary>
/// Gets the buffer then draws it to a <see cref="RenderTarget"/>.
/// </summary>
/// <param name="target">The <see cref="RenderTarget"/> to draw to.</param>
/// <param name="camera">The <see cref="ICamera2D"/> to use when drawing.</param>
/// <returns>True if the buffer was successfully drawn to the <paramref name="target"/>; otherwise false.</returns>
protected bool DrawBufferToTarget(RenderTarget target, ICamera2D camera)
{
// Get the buffer
var bufferImage = GetBuffer(camera);
if (bufferImage == null)
return false;
// Set up the sprite
_drawToTargetSprite.Texture = bufferImage;
_drawToTargetSprite.Position = target.MapPixelToCoords(Vector2.Zero).Round();
var bufferImageSize = bufferImage.Size;
_drawToTargetSprite.TextureRect = new IntRect(0, 0, (int)bufferImageSize.X, (int)bufferImageSize.Y);
// Reset RenderStates
_renderStates.Shader = DrawToTargetShader;
_renderStates.BlendMode = BlendMode.Alpha;
_renderStates.Transform = Transform.Identity;
_renderStates.Texture = null;
// Draw to the target
HandleDrawBufferToTarget(bufferImage, _drawToTargetSprite, target, camera, _renderStates);
return true;
}