本文整理汇总了C#中SFML.Graphics.Sprite.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.Draw方法的具体用法?C# Sprite.Draw怎么用?C# Sprite.Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.Sprite
的用法示例。
在下文中一共展示了Sprite.Draw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GaussianBlurRadius11_ShouldBlur
public void GaussianBlurRadius11_ShouldBlur()
{
preblur = new RenderImage("testGaussianBlur", 1280, 768);
_gaussianBlur = new GaussianBlur(_resourceManager);
_gaussianBlur.SetRadius(11);
_gaussianBlur.SetAmount(2);
_gaussianBlur.SetSize(new Vector2f(preblur.Width, preblur.Height));
while (CluwneLib.IsRunning)
{
var lastFrameTime = clock.ElapsedTime.AsSeconds();
clock.Restart();
_frameEvent = new FrameEventArgs(lastFrameTime);
CluwneLib.ClearCurrentRendertarget(Color.Black);
CluwneLib.Screen.DispatchEvents();
preblur.BeginDrawing(); // set temp as CRT (Current Render Target)
//preblur.Clear(); //Clear
sprite = _resourceManager.GetSprite("flashlight_mask");
sprite.Position = new Vector2f();
sprite.Draw();
preblur.EndDrawing(); // set previous rendertarget as CRT (screen in this case)
//_gaussianBlur.PerformGaussianBlur(preblur); // blur rendertarget
preblur.Blit(0,0, preblur.Width, preblur.Height,Color.White, BlitterSizeMode.Crop ); // draw blurred nosprite logo
CluwneLib.Screen.Display();
}
}
示例2: DrawImage
/// <summary>
/// Draws a rectangle with an image.
/// If the image doesn't match the size of the rectangle, the image is repeated.
/// </summary>
/// <param name="img">Image to use.</param>
/// <param name="imgSrcRect">Source region of the image to use.</param>
/// <param name="rect">Rectangle to draw.</param>
/// <param name="color">Tint to give to the image.</param>
public void DrawImage(Texture img, FloatRect rect, IntRect imgSrcRect, Color color)
{
img.Repeated = true;
Sprite srect = new Sprite(img, imgSrcRect);
srect.Position = new Vector2f(rect.Left + Translation.X, rect.Top + Translation.Y);
srect.Scale = new Vector2f(rect.Width / (float)imgSrcRect.Width, rect.Height / (float)imgSrcRect.Height);
srect.Color = ActualColor(color);
srect.Draw(myTarget, RenderStates.Default);
}
示例3: Blit
/// <summary>
/// Creates a Sprite from RenderImage Texture and draws it to the screen
/// </summary>
/// <param name="Position"> Position of Texture </param>
/// <param name="Size"> Size of the Texture </param>
/// <param name="color"> Global color of object </param>
public void Blit(SFML.System.Vector2f position, SFML.System.Vector2f Size, SFML.Graphics.Color color)
{
isStillDrawing();
blitsprite = new SFML.Graphics.Sprite(Texture);
blitsprite.Position = position;
blitsprite.Color = color;
var bounds = blitsprite.GetLocalBounds();
if (Mode == BlitterSizeMode.Scale)
{
SFML.System.Vector2f scale = new SFML.System.Vector2f(( Size.X / bounds.Width ),( Size.Y / bounds.Height ));
blitsprite.Scale = scale;
}
else if (Mode == BlitterSizeMode.Crop)
{
IntRect crop = new IntRect((int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y);
blitsprite.TextureRect = crop;
}
if (CluwneLib.CurrentRenderTarget == this)
return;
blitsprite.Draw();
}
示例4: RenderWorking
private void RenderWorking()
{
window.Clear(Color.Black);
textureOne.Clear(Color.White);
textureOne.Display();
var renderSprite = new Sprite(textureOne.Texture);
// Note #2
// renderSprite.Position = new Vector2f(Mouse.GetPosition(window).X, Mouse.GetPosition(window).Y);
renderSprite.Draw(window, RenderStates.Default);
// Note #1
// window.Display();
}