using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML.Window;
using SFML.Graphics;
namespace SFML_MatrixTest2
{
class Program
{
public static void Main(string[] args)
{
RenderWindow renderWindow = new RenderWindow(new VideoMode(800, 500), "SFML!", Styles.Default, new ContextSettings(0, 0, 8));
renderWindow.Closed += (s, e) => Environment.Exit(0);
renderWindow.SetFramerateLimit(60);
RectangleShape rect = new RectangleShape(new Vector2f(100, 70));
rect.FillColor = Color.Red;
rect.OutlineThickness = 2f;
rect.OutlineColor = Color.Green;
RenderTexture renderTexture = new RenderTexture(100, 100);
Sprite renderSprite = new Sprite(renderTexture.Texture);
while (true)
{
renderWindow.DispatchEvents();
renderWindow.Clear();
renderTexture.Clear(Color.Blue);
rect.Position = new Vector2f(50, 50);
rect.CenterOrigin();
rect.Rotation += 0.2f;
renderTexture.Draw(rect);
renderTexture.Smooth = true;
renderSprite.CenterOrigin();
renderSprite.Rotation = rect.Rotation;
renderSprite.Position = new Vector2f(200, 200);
renderSprite.Scale = new Vector2f(3, 3);
renderWindow.Draw(renderSprite);
renderWindow.Display();
}
}
}
}
Center origin might be missing, its just:
internal static void CenterOrigin(this Sprite sprite)
{
sprite.Origin = new SFML.Window.Vector2f(sprite.TextureRect.Width * 0.5f, sprite.TextureRect.Height * 0.5f);
}
internal static void CenterOrigin(this RectangleShape rect)
{
var bounds = rect.GetLocalBounds();
rect.Origin = new Vector2f(bounds.Width * 0.5f, bounds.Height * 0.5f);
}
Anyway, the draw to the render texture doesnt seem to be anti aliased
How do I enable it when drawing to render textures?