SFML community forums
Help => Graphics => Topic started by: fatih on December 28, 2012, 07:41:47 pm
-
I am trying to make some basic exercise of one simly game. Character is loaded from file, but it have box around it. With aseprite i put transparent background of character, but it still have box. Dimensions of character is 30x30.
[attachment deleted by admin]
-
Use PNG instead of Bitmaps, and make the parts outside the character transparent (alpha value 0).
If you can say that all pixels with a certain color should be transparent, you can use color masks with sf::Image::createMaskFromColor().
-
Sidenote: Try to hold your width and height equal to powers of 2. So that your sprite is 32x32. Because usually screen dimensions are in powers of 2.
-
Because usually screen dimensions are in powers of 2.
So? ;D
It really is not important what width and height is used, as long as it fits the needs.
Many people use numbers with power of 2, but mostly because of either old times where for instance graphic cards only supported textures with sides of power by two or because it's a bit geeky and sometimes makes things fit a bit nicer, but if there's no need, then it's rather bad to do stuff just because. ;)
-
Sidenote: Try to hold your width and height equal to powers of 2. So that your sprite is 32x32. Because usually screen dimensions are in powers of 2.
This is useful for repeated textures, but outside of it, it doesn't really matter or even is worth it since it limits you and may make you have a texture size filled with extra alpha just for the sake of it.
-
I think SFML will make textures go up to closest bigger power of 2 if gpu needs that. So don't do that yourself.
-
Thanks, you are all right, but i found best solution: go to aseprite pick transparent color and draw mask. Sorry for my Englich.