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

Author Topic: Some help with resolution displaying correctly using View  (Read 1046 times)

0 Members and 1 Guest are viewing this topic.

LedLoaf

  • Guest
Some help with resolution displaying correctly using View
« on: August 13, 2017, 11:17:19 pm »
int main()
{

        Vector2f resolution;
        resolution.x = VideoMode::getDesktopMode().width;
        resolution.y = VideoMode::getDesktopMode().height;

        // Create and open a window for the game
        RenderWindow window(VideoMode(resolution.x, resolution.y), "Timber!!!", Style::Fullscreen);

        // Create a an SFML View for the main action
        View mainView(sf::FloatRect(0, 0, resolution.x, resolution.y));
 

 // Clear everything from the last frame
                window.clear();

                window.setView(mainView);

                // Draw our game scene here
                window.draw(spriteBackground);
 

       
                window.display();


        }

        return 0;
}

I still can't figure out how to get my game example (which are 1920 x 1080) scaled to my 4k resolution. It goes full screen, but the game itself is tiny in the top left corner (most likely displaying 1920x1080) and not scaling to my desktop mode. Any help ? This has really been bugging me.
« Last Edit: August 13, 2017, 11:38:08 pm by LedLoaf »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Some help with resolution displaying correctly using View
« Reply #1 on: August 13, 2017, 11:31:38 pm »
Do you understand what the view does and how it works? Or did you just copy & paste some code? ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

LedLoaf

  • Guest
Re: Some help with resolution displaying correctly using View
« Reply #2 on: August 13, 2017, 11:37:43 pm »
Well I'm learning from a book. And that's all its giving me. I just pasted parts of my file on the view part since its really long. I then transferred it to the 1st game you work on and it just displays the same way previously. I'll add the file if that helps lol.

EDIT: I copied the code that I thought would get this game scaling correctly. And from my understanding the view would take what it is looking at and present it that way. Or am I totally wrong?
« Last Edit: August 13, 2017, 11:41:04 pm by LedLoaf »

LedLoaf

  • Guest
Re: Some help with resolution displaying correctly using View
« Reply #3 on: August 14, 2017, 08:07:04 pm »
Well! Thanks for the help guys!

SOLUTION: Just screw 4K resolution and go to 1920 x 1080! No problem then!