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

Author Topic: Sprite fit the Whole Window  (Read 2554 times)

0 Members and 1 Guest are viewing this topic.

John doe

  • Newbie
  • *
  • Posts: 2
    • View Profile
Sprite fit the Whole Window
« on: December 02, 2019, 11:45:42 pm »
Hey everyone,
I know that my question may seem so stupid, but I just began learning SFML and don't know much here. I was wondering how can I make my sprite fit the screen. I don't mean if I resized because I've seen so many posts on this. I mean normally when I set a sprite how to make it stretched out to fit the whole window no matter what their sizes are
Please any help
Thank you

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Sprite fit the Whole Window
« Reply #1 on: December 03, 2019, 04:01:31 pm »
Make a view the same size as the sprite. Or scale the sprite.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Sprite fit the Whole Window
« Reply #2 on: December 03, 2019, 05:06:56 pm »
Just to be clear, you can scale the sprite in-code using sprite.setScale() so you wouldn't - in this case - need to externally scale the original image.

You could also just use a sf::RectangleShape and give it the texture you want. Then, you can give the rectangle any size you want; it isn't locked to the texture rectangle in the same way that a sprite is.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*