SFML community forums

Help => Graphics => Topic started by: croux on March 26, 2014, 07:24:37 pm

Title: multiple tex per sprite problem
Post by: croux on March 26, 2014, 07:24:37 pm
Hi,

i am using one sprite to display multiple textures.
First is rocket and second is little bullet.

The problem is, that displayed image is changing width and height during displaying.

Here is screenshot - http://postimg.org/image/ueeufodc9/
U can see original images in the green area.

source code:

sf::Sprite s;

for(....){
        s.setPosition(grid[x+i][y+j].bullets[k].x,grid[x+i][y+j].bullets[k].y);
   s.setRotation(grid[x+i][y+j].bullets[k].r* PIOVER);
   s.setTexture(bullets_tex[grid[x+i][y+j].bullets[k].id]);
   (window_argument).draw(s);
}

Thanks for help.
Title: Re: multiple tex per sprite problem
Post by: Gobbles on March 27, 2014, 03:54:27 am
I'm not entirely sure what you're trying to achieve. You trying to draw both the rockets and bullets inside of one sprite as they move?
Title: Re: multiple tex per sprite problem
Post by: coderx0x on March 27, 2014, 10:13:38 am
 s.setTexture(bullets_tex[grid[x+i][y+j].bullets[k].id], true);
use true for reset texture rects
Title: Re: multiple tex per sprite problem
Post by: croux on March 27, 2014, 11:08:47 am
thanks it work :)