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

Author Topic: Scaling to fit  (Read 1547 times)

0 Members and 1 Guest are viewing this topic.

sgraves66

  • Newbie
  • *
  • Posts: 6
    • View Profile
Scaling to fit
« on: June 15, 2013, 07:48:48 am »
Given a viewport of 1920x1080, I need to scale a 252x128 png into an 800x600 sprite, ignoring the aspect ratio. I'm new to SFML and was unable to find a resize() method. My eyes may be getting tired, but this should be a simple task to figure out. Am I overlooking something?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Scaling to fit
« Reply #1 on: June 15, 2013, 08:31:41 am »
sprite.setScale(800. / 252., 600. / 128.);

Of course, replace these constants with the variables that hold the corresponding values in tour code ;)
Laurent Gomila - SFML developer

sgraves66

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Scaling to fit
« Reply #2 on: June 24, 2013, 04:24:51 am »
sprite.setScale(800. / 252., 600. / 128.);

Of course, replace these constants with the variables that hold the corresponding values in tour code ;)

Thanks. Yep, old age is getting the best of me  :'(

 

anything