Not sure what I'm doing wrong here.
when I display my textures with
window.draw(Spritesheet.at(1));
they all appear as white squares.
I have these variables in my main.h
//the main spritesheet.
Image sheetIMG;
//array to hold circles.
vector<CircleShape> Circles;
//array to hold sprites.
vector<Sprite> Spritesheet;
below is the offending code.
int LoadSpritesheet()
{
//make sure spritesheet exists, then loads it into an image.
Texture sheet;
if (!sheet.loadFromFile("Sprites/A.png"))
{
return 0;
}
else
{
sheetIMG = sheet.copyToImage();
MakeSprites();
return 1;
}
}
void MakeSprites()
{
//turns the entire spritesheet into 8x8 modular sprites.
Texture tex;
int c = 0, r = 0;
for (int i = 0; i <= (sheetIMG.getSize().x * sheetIMG.getSize().y) / 64; i++)
{
if (i == 125)
{
Sprite sprsdsds;
}
if (!tex.loadFromImage(sheetIMG, IntRect(0, 0, 8, ))
break;
else
{
Sprite spr;
spr.setTexture(tex);
Spritesheet.push_back(spr);
c += 8;
if (c == 16) { r++; };
}
}
}