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

Author Topic: A simple question of resolution problem  (Read 1619 times)

0 Members and 2 Guests are viewing this topic.

Marcelo

  • Newbie
  • *
  • Posts: 2
    • View Profile
A simple question of resolution problem
« on: April 21, 2017, 07:30:22 pm »
Hello, i have the following problem:

My game is designed to 1920x1080 screen resolutions, but in my PC the screen is 1600x900... well, i thought, it's the same aspect ratio (16:9), so i should not have problems scaling images from 1920.. to 1600... but yes!, i have problems! I attached the original image, and the scaled image, and you can see the differents.

I tried to use view, scale texture, i read N posts in this forum, etc. but ever had the same problem. My code is the following:

int main()
{
        bool finish = false;
        sf::RenderWindow window;

        sf::Texture texture;
        sf::Sprite sprite;

        texture.loadFromFile("resources\\FirstBKGRND.png");
        sprite.setTexture(texture);
        sprite.setPosition(sf::Vector2f(0, 0));
        window.create(sf::VideoMode(1600, 900, 32), "Donuts", sf::Style::Fullscreen);


        sf::View view;
        view.reset(sf::FloatRect(0, 0, 1920, 1080));
        view.setViewport(sf::FloatRect(0.f, 0.f, 1.f, 1.f));
        window.setView(view);

        while (!finish)
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                finish = true;
                }

                window.clear(sf::Color::White);
                window.draw(sprite);
                window.display();
        }
        return 0;
}

 

I hope that you can help me!
« Last Edit: April 21, 2017, 08:38:39 pm by Marcelo »

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: A simple question of resolution problem
« Reply #1 on: April 21, 2017, 08:01:52 pm »
Does your image have any alpha values less than 0xff? That's what it looks like to me - you're clearing white, and the somewhat transparent areas are showing the white through.

EDIT: Yep, took a look. Your background is transparent, hence the white showing through.

Marcelo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: A simple question of resolution problem
« Reply #2 on: April 21, 2017, 08:36:30 pm »
Thanks, but i'm sure that the problem ocurred with others images without transparency. I'll check it anyway!