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

Author Topic: sprites filed with ,,strange-shaped textures,,  (Read 1380 times)

0 Members and 1 Guest are viewing this topic.

CreaM

  • Newbie
  • *
  • Posts: 36
    • View Profile
sprites filed with ,,strange-shaped textures,,
« on: May 18, 2014, 03:00:00 pm »
hello, im filling sprites with textures - for example with image of ball. When i transfer it to texture and then use this texture for sprite... the sprite wont be just ball, but ball on some square white background (background of image i used)...
so how can i make sprite to ignore background of its image? - have i define all points i want to ignore? - cant i just tell sprite to ignore some colors of its texture? what about sprite of ring (transparent in middle)- for example.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: sprites filed with ,,strange-shaped textures,,
« Reply #1 on: May 18, 2014, 03:06:47 pm »
That's because your image has white pixels, not transparent pixels.  You don't need to do anything special to make transparency work in SFML if the image file already has transparent pixels.

If you don't know how to make an image with transparency, that's probably because the default Windows Paint program can't do it.  A better program like Paint.net makes it easy.

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: sprites filed with ,,strange-shaped textures,,
« Reply #2 on: May 18, 2014, 03:07:23 pm »
Well, don't use a white background on your image, use a transparent one... (png)
Alternatively, use sf::Image::createMaskFromColor