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

Author Topic: My character has box around it  (Read 2590 times)

0 Members and 1 Guest are viewing this topic.

fatih

  • Newbie
  • *
  • Posts: 6
    • View Profile
My character has box around it
« 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]

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: My character has box around it
« Reply #1 on: December 28, 2012, 07:45:31 pm »
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().
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

timo777

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: My character has box around it
« Reply #2 on: December 28, 2012, 08:24:25 pm »
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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: My character has box around it
« Reply #3 on: December 28, 2012, 08:54:40 pm »
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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: My character has box around it
« Reply #4 on: December 28, 2012, 09:30:42 pm »
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.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: My character has box around it
« Reply #5 on: December 28, 2012, 09:36:38 pm »
I think SFML will make textures go up to closest bigger power of 2 if gpu needs that. So don't do that yourself.
Back to C++ gamedev with SFML in May 2023

fatih

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: My character has box around it
« Reply #6 on: December 29, 2012, 06:52:28 pm »
Thanks, you are all right, but i found best solution: go to aseprite pick transparent color and draw mask. Sorry for my Englich.

 

anything