Dzięki za odpowiedź, sprawdzę to RTT, co do reszty to tak jak pisałem jestem w tym nowy i nie rozumiem znaczenia dwóch rzeczy, jeśli był byś w stanie mi je objaśnić będę wdzięczny:
- atlasie/spritesheet,
- VBO,
Co do mojego sposobu zjada to dość dużo procesora, a uproszczona wersja jest taka:
public class Main : Game
{
private GraphicsDeviceManager Graphics;
private SpriteBatch SpriteBatch;
public Dictionary<string, Texture2D> Textures;
public List<AAA> TabelaAAA;
public Main()
{
this.Graphics = new GraphicsDeviceManager(this);
this.Content.RootDirectory = "Content";
this.Textures = new Dictionary<string, Texture2D>();
this.TabelaAAA = new List<AAA>();
}
protected override void LoadContent()
{
this.SpriteBatch = new SpriteBatch(this.GraphicsDevice);
// Ładowanie textur
this.LoadContent("Textura1");
this.LoadContent("Textura2");
// Tworzenie obiektów do wyświetlania
this.TabelaAAA.Add(new AAA(this.Textures["Textura1"], new Rectangle(0, 0, 10, 10)));
this.TabelaAAA.Add(new AAA(this.Textures["Textura1"], new Rectangle(1, 1, 10, 10)));
this.TabelaAAA.Add(new AAA(this.Textures["Textura2"], new Rectangle(2, 2, 10, 10)));
}
public void LoadContent(string name)
{
this.Textures.Add(name, this.Content.Load<Texture2D>(name));
}
protected override void Draw(GameTime gameTime)
{
this.GraphicsDevice.Clear(Color.CornflowerBlue);
foreach (AAA a in this.TabelaAAA)
a.Draw(this.SpriteBatch);
}
}
public class AAA
{
public Texture2D Texture;
public Rectangle Bounds;
public AAA(Texture2D texture, Rectangle bounds)
{
this.Texture = texture;
this.Bounds = bounds;
}
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(this.Texture, this.TotalBounds, Color.White);
}
}
Przy większych ilościach obiektów zjada ten sposób dużo procesora (mówię tu o około 5000 textur).