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

Author Topic: What is the best way to draw textures?  (Read 2044 times)

0 Members and 3 Guests are viewing this topic.

AndreeU17

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
What is the best way to draw textures?
« on: June 10, 2014, 02:14:42 am »
I read the tutorial for sprite but i found a few things hard to understand. Before i go and reread it, i'd like to ask a few questions of the top of my head.

A texture is just a specific design, the entity is a specific shape, now the sprite is just a texture laid onto a shape.
Now i was wondering, would it be more convenient if instead of having numerous of textures in my resource folder, have one bit texture that contains multiple textures inside of it like a sprite sheet? Also lets say i did have a sprite sheet, how can i implicitly obtain a specific texture for a sprite? Would i need to use the sf::initRec (Not sure how it was spelled), then specify a value of were the texture is locate?

I'm just a bit confused as to how all this works, also what is the best way if i was trying to save idk graphics or save speed(images load faster)?

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: What is the best way to draw textures?
« Reply #1 on: June 10, 2014, 03:02:26 am »
You're on the right track! You'll want to look into using sf::Sprite::SetTextureRect(sf::IntRect) AFTER using sf::Sprite::SetTexture(sf::Texture).

AndreeU17

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: What is the best way to draw textures?
« Reply #2 on: June 10, 2014, 05:54:53 am »
You're on the right track! You'll want to look into using sf::Sprite::SetTextureRect(sf::IntRect) AFTER using sf::Sprite::SetTexture(sf::Texture).

So using this, sf::Sprite::SetTexture(sf::Texture) will set the texture of a sprite and using this sf::Sprite::SetTextureRect(sf::IntRect) will outline what part of the texture will be on the sprite? Believe it or not but i feel like im confusing myself more than what i should! Curse my Second Guessing!

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: What is the best way to draw textures?
« Reply #3 on: June 10, 2014, 07:52:33 am »
So using this, sf::Sprite::SetTexture(sf::Texture) will set the texture of a sprite and using this sf::Sprite::SetTextureRect(sf::IntRect) will outline what part of the texture will be on the sprite?

That's correct.

 

anything