SFML community forums
Help => Graphics => Topic started by: ShadowDancer on January 01, 2010, 03:31:55 pm
-
What will be best way to solve my problem? I tried
float Scale = Tileset.GetHeight() * 1.0f /Field_Size ;
sf::IntRect Rect((Element_Type*Tileset.GetHeight()) * Scale, 0, (Tileset.GetHeight()) * Scale, (Tileset.GetHeight())*Scale);
Tileset_Sprite.SetScale(Scale,Scale);Tileset_Sprite.SetSubRect(Rect);Tileset_Sprite.SetPosition(Field_Pos_X, Field_Pos_Y);
Render->Draw(Tileset_Sprite);
But it don't works.
Maybe is possible to make sprite from part of another sprite, but I don't found it. Any suggestions?
-
What do you exactly want to achieve? Express it in words, not code.
-
I want get scaled tile on my screen.
Edit. I forgot Imag.Copy. Sorry for making problems.
-
To scale a sprite just use SetScale.
-
Edit. I forgot Imag.Copy. Sorry for making problems.
What does sf::Image::Copy() have to do with this issue? You needn't edit the source image to scale your tiles, but the sprite.