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

Author Topic: multiple tex per sprite problem  (Read 1791 times)

0 Members and 1 Guest are viewing this topic.

croux

  • Newbie
  • *
  • Posts: 15
    • View Profile
multiple tex per sprite problem
« 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.

Gobbles

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: multiple tex per sprite problem
« Reply #1 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?

coderx0x

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: multiple tex per sprite problem
« Reply #2 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

croux

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: multiple tex per sprite problem
« Reply #3 on: March 27, 2014, 11:08:47 am »
thanks it work :)

 

anything