Some code to help.
Texture[] TextureArray = new Texture[10];
private void LoadTexture()
{
//MessageBox.Show("LoadTexture");
try
{
int currentrow = 1;
for (int i = 0; i <= numTargets; i++)
{
texture = TextureLoader.FromFile(device, System.Windows.Forms.Application.StartupPath + "\\images\\" + currentrow.ToString() + ".jpg");
TextureArray[i] = texture;
currentrow++;
}
}
catch
{
// We must be running from within Visual Studio. Relocate the
// current directory and try again.
System.IO.Directory.SetCurrentDirectory(
System.Windows.Forms.Application.StartupPath + @"\..\..\");
texture = TextureLoader.FromFile(device, textureFilename);
}
device.SamplerState[0].MinFilter = TextureFilter.Linear;
device.SamplerState[0].MagFilter = TextureFilter.Linear;
}
if (showTargets)//draw targets
{
.
.
. for (int i = 0; i < numTargets; i++)
{
device.SetTexture(0, TextureArray[i]);
device.Transform.World = Matrix.Scaling(targetSizes[i]);
device.Transform.World *= Matrix.Translation(targetPositions[i]);
device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
device.SetTexture(0, null);
}
}