Using the following with a stock project, I just cant seem to get the spritebatch working. This was no problem in previous versions (versions prior to the new scene stuff from within Paradox).
[STAThread]
private static void Main(string[] args)
{
using (var client = new Client())
{
client.Run();
}
}
internal class Client : Game
{
public Client()
{
IsFixedTimeStep = false;
}
protected override void Initialize()
{
base.Initialize();
Script.Add(new RenderScript());
}
}
public class RenderScript : Script
{
private SpriteBatch _spriteBatch;
private Texture _tile;
public override void Start()
{
base.Start();
_spriteBatch = new SpriteBatch(GraphicsDevice);
_tile = Texture.New2D(GraphicsDevice, 50, 50, PixelFormat.R8G8B8A8_UInt);
uint[] colors = new uint[50 * 50];
for (int i = 0; i < colors.Length; i++)
{
colors[i] = uint.MaxValue;
}
_tile.SetData(colors);
var scene = SceneSystem.SceneInstance.Scene;
var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
compositor.Master.Renderers.Add(new SceneDelegateRenderer(RenderQuad));
}
private void RenderQuad(RenderContext renderContext, RenderFrame frame)
{
_spriteBatch.Begin();
_spriteBatch.Draw(_tile, new Vector2(500, 500));
_spriteBatch.End();
}
}
I must be missing something, it’s just not obvious to me. Any ideas?