Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tuttoscorre

Pages: [1]
1
Graphics / Re: Change texture image for a sprite during runtime
« on: May 05, 2013, 01:21:11 pm »
You'll have to adjust the texture rect of the sprite. This can be done, either up on setting the texture (spr.setTexture(tex, true);) or by using the setTextureRect function of the the sprite.

Besides, you should in most cases preload the texture, so you don't waste valuable time, loading an image over and over again from the disk.

Now it works, thanks a lot!!

2
Graphics / Change texture image for a sprite during runtime
« on: May 05, 2013, 12:08:27 am »
Hi! I'm doing a enhanched version of Pong, and I want to make the ball became a fireball when I press "W" key. Everything is working good, in the costructor of my ball class I load the texture like this:
void Load(std::string filename) {
              if(_image.loadFromFile(filename) == false)
        {
                _filename = "";
                _isLoaded = false;
        }
        else
        {
                _filename = filename;
                _sprite.setTexture(_image);
                _isLoaded = true;
        }
}
 

Ok. Now I have to say that my first loading (default) .png texture is 20x20; while the second (fireball one) is 40x40.

When I change the sprite like this (on "W" press event):
Load("fireball.png");
 
yes, it changes, but the drawing area is the one of 20x20 default sprite, so I see only a piece of my fireball sprite! How can I solve this?

ps. If I load first the biggest texture it draws it well!

Thanks a lot.

3
General / Build SFML 1.6 for VS11
« on: April 26, 2013, 04:10:11 pm »
Hi!
As I say in the title, I want to build SFML 1.6 for VS11, but I can't find the source code with cmakelist.txt! Where is it? I only found that in sdk package there is a "src" folder, but didn't find cmakelist!

Thanks.

Pages: [1]