SFML community forums

Help => Graphics => Topic started by: zoran404 on March 18, 2013, 09:50:18 pm

Title: Dynamic texture
Post by: zoran404 on March 18, 2013, 09:50:18 pm
I have an image, the game map.
I have to use different part of the map as the player moves. And my idea is to use texture that would contain different part of the image.
But, since I'm new to sfml, I don't know how to set the texture to a certain part of the image and how to change the viewed part later on.
So, any ideas?
I know I can just set TextureRect for each element, but I don't want that.
Title: Re: Dynamic texture
Post by: Laurent on March 18, 2013, 10:16:03 pm
Quote
I know I can just set TextureRect for each element, but I don't want that.
Why? If it's not what you want, then I don't understand your problem.
Title: Re: Dynamic texture
Post by: zoran404 on March 18, 2013, 10:45:18 pm
Map image is realy big, so I want only the needed part it in the texture.
The other way requires the whole picture to be in the texture and texture has relatively small max size.
Title: Re: Dynamic texture
Post by: FRex on March 18, 2013, 10:48:52 pm
All Texture's loadFrom.. have second parameter that can be int rect so you can load only apart of image.