1
Graphics / Trying to draw sprites, but they appear white.
« on: July 02, 2011, 01:38:12 am »
So I have class tykk:
public:
class kaart:
and in main i have:
I tried to paste only the important parts of code. Im using 1.6. I get no errors, but it doesn't draw the "aare.png", it just leaves everything white.
public:
Code: [Select]
public:
tykk(void);
~tykk(void);
void drawIt(sf::RenderWindow&);
sf::Image a;
sf::Sprite pilt;
tykk::tykk(void)
{
a.LoadFromFile("aare.png");
pilt.SetImage(a);
}
void tykk::drawIt(sf::RenderWindow& rw){
rw.Draw(pilt);
}
class kaart:
Code: [Select]
class kaart
{
public:
tykk sisu[60][40];
kaart(int,int);
kaart(void);
~kaart(void);
};
kaart::kaart()
{
int a;
tykk b;
for(int i=0; i<60;i++){
for(int j=0; j<40;j++){
a = sf::Randomizer::Random(1,4);
if(a==1){
tykk b;
sisu[i][j]=b;
}
}
}
}
and in main i have:
Code: [Select]
sf::RenderWindow a(sf::VideoMode(800,600,32),"TT");
kaart krt;
for(int i=0;i<60;i++){
for(int j=0;j<40;j++){
krt.sisu[i][j].pilt.SetPosition(i*15,j*15);
krt.sisu[i][j].drawIt(a);
}
}
a.Display();
I tried to paste only the important parts of code. Im using 1.6. I get no errors, but it doesn't draw the "aare.png", it just leaves everything white.