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

Author Topic: Image gets distorted when maximize button is hit  (Read 1607 times)

0 Members and 1 Guest are viewing this topic.

rajhansk

  • Newbie
  • *
  • Posts: 21
    • View Profile
Image gets distorted when maximize button is hit
« on: October 31, 2017, 04:54:36 am »
I have  an image of 640x480. when I hit maximize button the whole image gets distorted. How do I keep the image un-stretched when window is maximized ?

achpile

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • Achpile's homepage
    • Email
Re: Image gets distorted when maximize button is hit
« Reply #1 on: October 31, 2017, 05:18:00 am »
void ach::Game::processEvent(sf::Event event) {
        switch(event.type) {
                case sf::Event::Resized:
                        app->setView(sf::View(sf::FloatRect(0, 0, app->getSize().x, app->getSize().y)));
...
 

or something like that

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Image gets distorted when maximize button is hit
« Reply #2 on: October 31, 2017, 07:43:20 am »
It is also explained in the tutorial about views.
Laurent Gomila - SFML developer