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

Author Topic: SFML equivalent of SDL Blitting?  (Read 1791 times)

0 Members and 1 Guest are viewing this topic.

PixelMuffin

  • Newbie
  • *
  • Posts: 18
    • View Profile
SFML equivalent of SDL Blitting?
« on: July 10, 2012, 08:35:09 pm »
Hi. I am working on my first SFML project and I am trying to figure out how to create a sprite using an x, y, width and height source from a texture.

For my example, I am working on a menu system with text and I would rather not save 20 different individual text images. Is such an operation possible in SFML?

Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML equivalent of SDL Blitting?
« Reply #1 on: July 10, 2012, 08:36:45 pm »
The sprite can show a sub-rectangle rather than the entire texture. Use Sprite::setTextureRect.
Laurent Gomila - SFML developer

PixelMuffin

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: SFML equivalent of SDL Blitting?
« Reply #2 on: July 10, 2012, 11:48:47 pm »
Thank you Laurent. You do fantastic work! :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML equivalent of SDL Blitting?
« Reply #3 on: July 11, 2012, 08:18:23 am »
Quote
You do fantastic work!
The online doc does an even more fantastic job :)
Laurent Gomila - SFML developer