SFML forum,
Switching over to SFML 2.0 from 1.6.
The first project is a conversion of one that is working in 1.6.
Not to bad so far but I'm have a problem with setTextureRect.
In 1.6 I used:
switch(num[index])
{
case 1: Numbers.SetSubRect(sf::IntRect(0,0,63,63)); break;
case 2: Numbers.SetSubRect(sf::IntRect(64,0,127,63)); break;
case 3: Numbers.SetSubRect(sf::IntRect(128,0,191,63)); break;
case 4: Numbers.SetSubRect(sf::IntRect(192,0,255,63)); break;
}
In 2.0 I use:
switch(index)
{
case 1: Numbers.setTextureRect(sf::IntRect(0,0,63,63)); break;
case 2: Numbers.setTextureRect(sf::IntRect(64,0,127,63)); break;
case 3: Numbers.setTextureRect(sf::IntRect(128,0,191,63)); break;
case 4: Numbers.setTextureRect(sf::IntRect(192,0,255,63)); break;
}
Here's how I created the sprite in 2.0:
sf::Texture MyNumbers;
MyNumbers.loadFromFile("Numbers2.png");
sf::Sprite Numbers;
The problem is when index is 1 I get:
1 this is correct
When it's 2 I get:
2 3 should be just 2
When it's 3 I get:
3 4 should be just 3
When it's 4 I get:
4 ###### should be just 4
The #s represent some garbage on the screen?
The Numbers2.png file is attached.
Jerryd
[attachment deleted by admin]